-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbomberman.py
57 lines (48 loc) · 1.7 KB
/
bomberman.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
from __future__ import print_function
from person import *
import random
class bomberman(person):
def makeBomber(self, x, y, array):
for i in range(x, x + 2):
for j in range(y, y + 4):
array[i][j] = 1
def destroySelf(self, array, Matrix, array1):
x = array[0]
y = array[1]
# if array1[x][y]==1 and array[2]==1:
# for i in range(2):
# for j in range(4):
# array1[i+2][j+4]=1
# array1[x+i][y+j]=0
# Matrix[x+i][y+j]=' '
# return 1
if array1[x + 2][y] == 1 and array[2] == 1:
for i in range(2):
for j in range(4):
array1[i + 2][j + 4] = 1
array1[x + 2 + i][y + j] = 0
Matrix[x + 2 + i][y + j] = ' '
return 1
elif array1[x - 2][y] == 1 and array[2] == 1:
for i in range(2):
for j in range(4):
array1[i + 2][j + 4] = 1
array1[x - 2 + i][y + j] = 0
Matrix[x - 2 + i][y + j] = ' '
return 1
elif array1[x][y + 4] == 1 and array[2] == 1:
for i in range(2):
for j in range(4):
array1[i + 2][j + 4] = 1
array1[x + i][y + 4 + j] = 0
Matrix[x + i][y + 4 + j] = ' '
return 1
elif array1[x][y - 4] == 1 and array[2] == 1:
for i in range(2):
for j in range(4):
array1[i + 2][j + 4] = 1
array1[x + i][y - 4 + j] = 0
Matrix[x + i][y - 4 + j] = ' '
return 1
else:
return 0