示例#1
0
 public Player(CheckerBrain brain)
 {
     myBrain     = brain;
     winCount    = 0;
     lossCount   = 0;
     gamesPlayed = 0;
 }
示例#2
0
 public Player(bool loadFromFile = false)
 {
     myBrain     = new CheckerBrain(loadFromFile);
     winCount    = 0;
     lossCount   = 0;
     gamesPlayed = 0;
 }
示例#3
0
        //has brain evaluate each potential move and returns a Board representing the move it chose.
        //Every CheckerBrain assumes it is black to cut down on the complexity of the neural network.
        //If the CheckerBrain in question is red, the board is inverted
        public static Board GetNextMove(Board currentState, CheckerBrain brain, bool isRed)
        {
            if (isRed)
            {
                currentState.Invert();
            }
            List <Board> potentialMoves = GetPossibleMoves(currentState);

            //no valid moves for this player
            if (potentialMoves.Count == 0)
            {
                if (isRed)
                {
                    currentState.Invert();
                }
                return(currentState);
            }
            Board nextMove = brain.DecideNextMove(potentialMoves);

            if (isRed)
            {
                nextMove.Invert();
            }

            return(nextMove);
        }
示例#4
0
        private void InitializeAIGame()
        {
            DrawBoard(new Board());
            CheckerBrain red, black;

            red         = new CheckerBrain(true);
            black       = new CheckerBrain(true);
            currentGame = new GameInstance(black, red);
        }
示例#5
0
        public GameInstance(CheckerBrain black, CheckerBrain red)
        {
            AIvsAI      = true;
            blackTurn   = true;
            redPlayer   = red;
            blackPlayer = black;

            _boardState = new Board();
        }
示例#6
0
 //returns a new CheckerBrain with the same synaptic weights
 public CheckerBrain(CheckerBrain parent)
     : base(parent)
 {
 }