-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcoins.py
40 lines (31 loc) · 1.12 KB
/
coins.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from colorama import Fore,Back,init
import os
import signal
import random
class Coins:
def __init__(self,xstart,ystart):
self.__coins=[]
self.__xstart=xstart
self.__ystart=ystart
def defineCoins(self):
with open("./background/coins.txt") as coins:
for line in coins:
self.__coins.append(line.strip("\n"))
def createCoins(self,matrix):
count=0
for i in range(2):
for j in range(5):
if(matrix[self.__xstart + i][self.__ystart +j] == " "):
count=count+1
if(count==10):
for i in range(2):
for j in range(5):
matrix[self.__xstart + i][self.__ystart +j]=Fore.YELLOW +self.__coins[i][j]+ '\x1b[0m'
self.__xstart=self.__xstart + random.randint(0,10)
self.__xstart=self.__xstart - random.randint(0,10)
if(self.__xstart <=7):
self.__xstart=7
if(self.__xstart >=25 ):
self.__xstart=25
self.__ystart=self.__ystart + 60 + random.randint(0,9)
return [self.__xstart,self.__ystart]