-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzappers.py
80 lines (64 loc) · 2.17 KB
/
zappers.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
from colorama import Fore,Back,init
import os
import signal
import random
class Beam:
def __init__(self,xstart,ystart):
self._xstart=xstart
self._ystart=ystart
self._xi=0
self._yj=0
def createBeams(self,matrix):
count=0
for i in range(self._xi):
for j in range(self._yj):
print(self._xstart, self._ystart)
if(matrix[self._xstart + i][self._ystart +j] == " "):
count=count+1
if(count==5):
for i in range(self._xi):
for j in range(self._yj):
matrix[self._xstart + i][self._ystart +j]=Back.RED + Fore.WHITE+ "*" + '\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 >=24 ):
self._xstart=24
self._ystart=self._ystart + 60 + random.randint(0,9)
return [self._xstart,self._ystart]
class BeamHori(Beam):
def __init__(self,xstart,ystart):
self._xstart=xstart
self._ystart=ystart
self._xi=1
self._yj=5
class BeamVert(Beam):
def __init__(self,xstart,ystart):
self._xstart=xstart
self._ystart=ystart
self._xi=5
self._yj=1
class BeamSla(Beam):
def __init__(self,xstart,ystart):
self._beamss=[]
self._xstart=xstart
self._ystart=ystart
self._yj=0
self._xi=0
def createBeams(self,matrix):
count=0
for i in range(5):
if(matrix[self._xstart + i][self._ystart +i] == " "):
count=count+1
if(count==5):
for i in range(5):
matrix[self._xstart + i][self._ystart +i]=Back.RED + Fore.WHITE+"*"+ '\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 >=24 ):
self._xstart=24
self._ystart=self._ystart + 60 + random.randint(0,9)
return [self._xstart,self._ystart]