Exemplo n.º 1
0
        private static IGamePlayer FetchPlayer(GameParameter gameParameter)
        {
            IGamePlayer gamePlayer;

            switch (gameParameter.PlayerType)
            {
            case PlayerType.Human:
                gamePlayer = new HumanPlayer();
                break;

            case PlayerType.AI:
                gamePlayer = new AiLoader().LoadFromJsonfile(gameParameter.FilePath).First();
                break;

            case PlayerType.Random:
                gamePlayer = new RandomGamePlayer();
                break;

            default:
                throw new ApplicationException($"Unknown player type '{gameParameter.PlayerType}'");
            }
            return(gamePlayer);
        }
Exemplo n.º 2
0
        public static void DefaultGameSetup(
            [ClArgs("white", "w")]
            GameParameter whiteGameParameter = null,
            [ClArgs("black", "b")]
            GameParameter blackGameParameter = null
            )
        {
            if (null == whiteGameParameter)
            {
                whiteGameParameter = new GameParameter(PieceColour.White, PlayerType.Human);
            }
            if (null == blackGameParameter)
            {
                blackGameParameter = new GameParameter(PieceColour.Black, PlayerType.Human);
            }

            var gameParameterList = new List <GameParameter>
            {
                whiteGameParameter,
                blackGameParameter
            };

            GameParameterList = gameParameterList;
        }