def test_just_visiting(): """" Handles test case of landing on the jail/just visting """ sq = Jail() p = Player() game = Game(players=[p]) old = game.getPlayers() sq.run(0, game) ran = game.getPlayers() #current player and all players assert old == ran
def test_player_alive_money(): game = Game() game.setPlayers([Player()]) player = game.getPlayers()[0] player.setMoney(0) game.checkMoneyRule(player) assert player.getAlive() == False
def test_game_over_true(): game = Game() game.setPlayers([Player(),Player()]) a = game.getPlayers() a[1].setAlive(False) game.checkGameOver() assert game.getGameOver() == True
def test_setPlayers(): game = Game() a = [Player(),Player()] game.setPlayers(a) assert game.getPlayers() != None
from Game.Game import Game from Game.TurnOrder import TurnOrder from Game.rules import Rules if __name__ == "__main__": game = Game() turn = TurnOrder(range(len(game.getPlayers()))) order = iter(turn) manager = Rules(game) while (not game.getGameOver()): currentPlayer = game.getPlayer(next(order)) roll1 = random() roll2 = random() manager.roll(currentPlayer, roll1, roll2) manager.landSquare() #game.action(handleInput()) #trade . upgrade . end #accept end turn or other actions #GUI.update(game) game.checkGameOver()