Пример #1
0
        static Player LearnVsNaive(int gameCount)
        {
            Player white, black;
            var    game = new BackgammonGame(BackgammonGame.DefaultGameBoard, new RealDice());

            if (gameCount % 2 == 0)
            {
                white = new MachAI(game);
                black = new NaiveAI(game, Black);
            }
            else
            {
                black = new MachAI(game);
                white = new NaiveAI(game, White);
            }
            while (!TemporalDifference.GameOver(game.GetGameBoardState()))
            {
                if (game.playerToMove() == White)
                {
                    white.MakeMove();
                }
                else
                {
                    black.MakeMove();
                }
            }
            TemporalDifference.UpdateWeights(game.GetGameBoardState(), game.GetGameBoardState(), (gameCount % 2 == 0) ? White : Black);
            return((game.GetGameBoardState().getCheckersOnTarget(White) == 15) ? white : black);
        }
Пример #2
0
        static CheckerColor PitMachVsNaive(int gameCount)
        { // MachAI
            var    game  = new BackgammonGame(BackgammonGame.DefaultGameBoard, new RealDice());
            Player white = new MachAI(game);
            Player black = new NaiveAI(game, Black);

            while (!TemporalDifference.GameOver(game.GetGameBoardState()))
            {
                if (game.playerToMove() == White)
                {
                    white.MakeMove();
                }
                else
                {
                    black.MakeMove();
                }
            }
            return((game.GetGameBoardState().getCheckersOnTarget(White) == 15) ? White : Black);
        }