forked from idealista/zombie-apocalypse-kata
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBoard.py
71 lines (51 loc) · 2.23 KB
/
Board.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
from shutil import move
class Board:
size = 0
board = [[]]
<<<<<<< HEAD
characters = {}
=======
charcters = {}
>>>>>>> eb44e3e5c7fc82d7802f814b111fffea77a6e273
def __init__(self, size):
self.size = size
self.board = [[0 for x in range(size)] for y in range(size)]
def add(self, board_element, x, y):
self.board[x][y] = board_element
self.characters[board_element.name] = {"x":x, "y":y, "element": board_element}
<<<<<<< HEAD
def executeInstruction(self, instruction):
if instruction.type == "M":
character_position = self.characters[instruction.character_name]
moveCharacter(character_position, instruction.direction)
elif instruction.type == "P":
character_position = self.characters[instruction.character_name]
item_position = self.characters[instruction.item_name]
item_added = character_position.element.addItem(self, instruction.spot, item_position.element)
if item_added == True:
self.board[item_position.x][item_position.y] = 0
elif instruction.type == "R":
elif instruction.type == "A":
def moveCharacter(self, character_position, movement):
self.board[character_position.x][character_position.y] = 0
if movement == "Up":
self.add(self, character_position.element, character_position.x, character_position.y+1)
elif movement == "Down":
self.add(self, character_position.element, character_position.x, character_position.y-1)
elif movement == "Right":
self.add(self, character_position.element, character_position.x+1, character_position.y)
elif movement == "Left":
self.add(self, character_position.element, character_position.x-1, character_position.y)
=======
#def executeInstruction(self, instruction):
# if instruction.type == "M":
#
# elif instruction.type == "P":
#
# elif instruction.type == "R":
#
# elif instruction.type == "A":
#
#def findCharacter(self, type):
>>>>>>> eb44e3e5c7fc82d7802f814b111fffea77a6e273
#Hay que definir que los zombies y supervivientes no puedan salir del mapa