Compare commits
No commits in common. "97957238fb6058cd8999259c07644d0cbb2c7afc" and "521e767741e367d655f9f1c5cdbf7898524c522c" have entirely different histories.
97957238fb
...
521e767741
35
GameLogic.py
35
GameLogic.py
@ -1,35 +1,2 @@
|
|||||||
from GameMap import *
|
|
||||||
from Player import *
|
|
||||||
|
|
||||||
class GameLogic():
|
class GameLogic():
|
||||||
|
pass
|
||||||
def __init__(self, gameMap, playerList, winRowLength, individualMoves):
|
|
||||||
|
|
||||||
self.gameMap = gameMap
|
|
||||||
self.playerList = playerList
|
|
||||||
self.winRowLength = winRowLength
|
|
||||||
self.individualMoves = individualMoves
|
|
||||||
self.time = 0 # in seconds
|
|
||||||
self.score = 0
|
|
||||||
|
|
||||||
self.wait_for_input()
|
|
||||||
|
|
||||||
|
|
||||||
def wait_for_input(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def check_for_win(self, playerList):
|
|
||||||
for player in playerList:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def get_time(self):
|
|
||||||
return self.time
|
|
||||||
|
|
||||||
|
|
||||||
def reset_time(self):
|
|
||||||
self.time = 0
|
|
||||||
|
|
||||||
|
|
||||||
def get_score(self):
|
|
||||||
return self.score
|
|
17
GameMap.py
17
GameMap.py
@ -17,21 +17,16 @@ class GameMap:
|
|||||||
return self.size_y
|
return self.size_y
|
||||||
|
|
||||||
|
|
||||||
def add_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) and (x >= 0 and y >= 0):
|
if (x <= self.max_size_x and y <= self.max_size_y) and (x >= 0 and y >= 0):
|
||||||
if (x, y) not in self.data:
|
self.data[(x,y)] = player
|
||||||
self.data[(x,y)] = player
|
player.record_mark(x, y)
|
||||||
else:
|
|
||||||
errorMessage = "The mark is already busy by the Player" + self.data[(x, y)].get_name()
|
|
||||||
raise KeyError(errorMessage)
|
|
||||||
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)
|
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(errorMessage)
|
raise IndexError(errorMessage)
|
||||||
|
|
||||||
|
|
||||||
def remove_mark(self, x, y):
|
|
||||||
data.pop((x,y))
|
|
||||||
|
|
||||||
|
|
||||||
def clear_map(self):
|
def clear_map(self):
|
||||||
data.clear()
|
self.data = {}
|
||||||
|
|
||||||
|
|
@ -8,9 +8,5 @@ class Player():
|
|||||||
return "Player " + self.name + ': ' + "\n " + str(self.markList)
|
return "Player " + self.name + ': ' + "\n " + str(self.markList)
|
||||||
|
|
||||||
|
|
||||||
def get_name(self):
|
|
||||||
return self.name
|
|
||||||
|
|
||||||
|
|
||||||
def record_mark(self, x, y):
|
def record_mark(self, x, y):
|
||||||
self.markList.append((x, y))
|
self.markList.append((x, y))
|
Loading…
Reference in New Issue
Block a user