def setUp(self): self.player = Player("player") self.player.history.append( Action.put(1, 1, Position(Piece("a"), Player("a")))) self.player.history.append( Action.put(1, 2, Position(Piece("a"), Player("a")))) self.player.history.append(Action.see(1, 1))
class Menu: def __init__(self): self.running = True self.actionMenu = False self.action = Action("") def printMenu(self): print("(1) New Action\n(2) Exit") def printActionMenu(self): print( "(1) Add a pro\n(2) Add a con\n(3) Display Summary\n(4) Go Back to Main Menu" ) def startMenu(self): while (self.running): self.printMenu() userIn = int(input()) if userIn == NEW_ACTION: self.actionMenu = True print("Please define the action...") self.action = Action(input()) self.insideActionMenu() elif (userIn == EXIT): self.running = False break def insideActionMenu(self): while (self.actionMenu): print("|---" + self.action.actionName + "---|") self.printActionMenu() userIn = int(input()) if (userIn == ADD_PRO): print("Please describe the pro...") proString = input() print("Please quantify the pro(+1...+10)") value = int(input()) self.action.addPro(proString, value) elif (userIn == ADD_CON): print("Please describe the con...") conString = input() print("Please quantify the con(-1...-10)") value = int(input()) self.action.addCon(conString, value) elif (userIn == DISPLAY_SUMMARY): print(self.action.getSummary()) elif (userIn == GO_BACK): self.actionMenu = False
def startMenu(self): while (self.running): self.printMenu() userIn = int(input()) if userIn == NEW_ACTION: self.actionMenu = True print("Please define the action...") self.action = Action(input()) self.insideActionMenu() elif (userIn == EXIT): self.running = False break
def __init__(self): self.lastAction = Action(0, 0)
def __init__(self): self.running = True self.actionMenu = False self.action = Action("")
def test_put(self): self.assertEqual(Action.put(1, 1, Position(Piece("a"), Player("a"))), "put: (%d, %d, %s)" % (1, 1, "a"))
def nums(self): self.assertEqual(Action.nums(), "nums")
def see(self): self.assertEqual(Action.see(1, 1), "sea: (%d, %d)" % (1, 1))
def eat(self): self.assertEqual(Action.eat(1, 2), "eat: (%d, %d)" % (1, 1))
def test_move(self): self.assertEqual(Action.move(1, 1, 2, 2), "move: from (1, 1) to (2, 2)")
def setUp(self): self.game = Game(Player("a"), Player("b"), Board("go")) self.game.player1.record( Action.put(1, 1, Position(Piece("a"), Player("a")))) self.game.player1.record(Action.see(1, 1))