Esempio n. 1
0
        public void triggerAI(Level level, GameTime gameTime)
        {
            Action <string> print = s => Console.WriteLine(s);

            print(level.ToString());
            IMove move = SingleThreaded.ComputeSingleThreadedUCT(level, true, print, 0.7F, 15);

            //IMove move = MultiThreaded.ComputeRootParallization(level, 100, true, print, 0.7f);
            print(move.Name);
            triggerAIBool = false;
            //currentMove = (Move)move;
            level.DoMove(move, gameTime); // Add boolean so that this animates and only prints this move
            level.thoughtBubble.position = Vector2.Zero;
            level.drewThoughtBubble      = false;
        }
Esempio n. 2
0
        public void NimsMctsV1(int token, EGameFinalStatus status)
        {
            Action <string> print       = s => Console.WriteLine(s);
            var             firstPlayer = new NimPlayer(1);
            var             nims        = new NimState(token) as IGameState;

            while (nims.GetMoves().Any())
            {
                print(nims.ToString());
                IMove move = SingleThreaded.ComputeSingleThreadedUCT(nims, 1000, true, print, 0.7F);
                print(move.Name);
                nims.DoMove(move);
            }
            print(nims.GetResult(firstPlayer).ToString());
            Assert.IsTrue(nims.GetResult(firstPlayer) == status);
        }