Compare commits

..

No commits in common. "7377f74d927c5999edbf00a300b9787d16fd7ec9" and "fc13448974e5412268759d6b3a0d01b0e8cafe55" have entirely different histories.

4 changed files with 4 additions and 24 deletions

2
.gitignore vendored
View File

@ -1,2 +0,0 @@
tester.py

View File

@ -1,2 +0,0 @@
class GameLogic():
pass

View File

@ -3,10 +3,10 @@ class GameMap:
def __init__(self, max_size_x = float('inf'), max_size_y = float('inf')): def __init__(self, max_size_x = float('inf'), max_size_y = float('inf')):
self.max_size_x = max_size_x self.max_size_x = max_size_x
self.max_size_y = max_size_y self.max_size_y = max_size_y
self.data = {} data = {}
def __str__(self): def __str__(self):
return str(self.data) return data
def get_max_size_x(self): def get_max_size_x(self):
@ -18,15 +18,12 @@ class GameMap:
def add_player_mark(self, x, y, player): def add_player_mark(self, x, y, player):
if x <= self.max_size_x and y <= self.max_size_y: if x <= max_size_x or y <= max_size_y:
self.data[(x,y)] = player self.data[(x,y)] = player
player.record_mark(x, y)
else: else:
errorMessage = "The mark" + str((x,y)) + " is beyond preset max values, max_x - " + str(self.max_size_x) + ", max_y - " + str(self.max_size_y) raise IndexError("Mark added beyond preset max values (max_x - " + self.max_size_x + ", max_y - " + self.max_size_y + ".")
raise IndexError(errorMessage)
def clear_map(self): def clear_map(self):
self.data = {} self.data = {}

View File

@ -1,13 +0,0 @@
class Player():
def __init__(self, name, color):
self.name = name
self.color = color
self.markList = []
def __str__(self):
return "Player " + self.name + ': ' + "Color - " + self.color + "\n " + str(self.markList)
def record_mark(self, x, y):
self.markList.append((x, y))