Beispiel #1
0
def step_impl(context, player_1, player_2, pos_1, pos_2):
    game = create_default_game()
    game.add_player(player_1)
    game.add_player(player_2)
    game.player_repository.update_position(player_1, int(pos_1))
    game.player_repository.update_position(player_2, int(pos_2))
    context.ui = create_default_ui(game)
Beispiel #2
0
    def test_create_default_game(self):
        game = create_default_game()
        self.assertTrue(isinstance(game, Game))
        self.assertTrue(
            isinstance(game.player_repository, DictPlayerRepository))
        self.assertTrue(isinstance(game.rule_engine, RuleEngine))

        rules = game.rule_engine.rules
        self.assertTrue(isinstance(rules[0], BasicMoveRule))

        self.assertTrue(isinstance(rules[1], BounceMoveRule))
        self.assertEqual(rules[1].n_spaces, N_SPACES)

        self.assertTrue(isinstance(rules[2], BridgeMoveRule))
        self.assertEqual(rules[2].bridge_start, BRIDGE_START)
        self.assertEqual(rules[2].bridge_end, BRIDGE_END)

        self.assertTrue(isinstance(rules[3], GooseMoveRule))
        self.assertEqual(rules[3].goose, GOOSE_SPACES)
        self.assertTrue(isinstance(rules[4], PrankMoveRule))

        if __name__ == '__main__':
            unittest.main()
Beispiel #3
0
def step_impl(context, player, pos):
    game = create_default_game()
    game.add_player(player)
    game.player_repository.update_position(player, int(pos))
    context.ui = create_default_ui(game)
Beispiel #4
0
def step_impl(context, player):
    game = create_default_game()
    game.add_player(player)
    context.ui = create_default_ui(game)
Beispiel #5
0
def step_impl(context):
    game = create_default_game()
    context.ui = create_default_ui(game)