Beispiel #1
0
        private GameState StartNewGame()
        {
            Console.WriteLine("Starting new game");

            Id          id        = Id.Generate();
            int         mode      = AskForMode();
            int         color     = AskForColor();
            PlayerState white     = PlayerFactory.Create(mode < 3 ? PlayerType.Human : PlayerType.Computer);
            PlayerState black     = PlayerFactory.Create(mode == 1 ? PlayerType.Human : PlayerType.Computer);
            GameState   gameState = Factory.Create(
                id,
                color == 1 ? white : black,
                color == 2 ? black : white
                );

            return(gameState);
        }
Beispiel #2
0
        public GameCommand()
        {
            IsCommand("game", "Start a new game or loads an existing game from the database or a PGN file");

            HasOption(
                "l|load=",
                "The ID of a game to load from the database.",
                v => _load = Id.FromString(v)
                );

            HasOption(
                "p|pgn=",
                "The path to a PGN file.",
                v => _pathToPgn = v
                );

            // TODO Implement DI for this stuff
            _storage = new Postgres();
        }
Beispiel #3
0
        private GameState LoadGame(Id gameId)
        {
            Console.WriteLine("Loading game with ID " + _load);

            return(_storage.Load(gameId));
        }