Esempio n. 1
0
    def test_game_run_with_ai(self, capsys):
        """Tests game run with 3 AI players and no human players."""
        config = GameConfig('tictactoe/tests/configs/config_with_3_ai.json')
        game = Game(config)

        with pytest.raises(SystemExit):
            game.run()
        captured = capsys.readouterr()

        # Assert game finished successfully and correct message is displayed.
        assert "Game finished" in captured.out and str(
            game.completed_turns) in captured.out
Esempio n. 2
0
def main(args=None):
    """Main program routine."""
    print(
        "=======================\nTic-Tac-Toe: Remastered\n======================="
    )

    config = GameConfig('config.json')
    # Note that config.json is exptected to be found in project root.

    if config.is_valid():
        # Intialize Game instance when we are sure the config is valid.
        game = Game(config)
        game.run()