Exemple #1
0
 public Player(CheckerBrain brain)
 {
     myBrain     = brain;
     winCount    = 0;
     lossCount   = 0;
     gamesPlayed = 0;
 }
Exemple #2
0
 public Player(bool loadFromFile = false)
 {
     myBrain     = new CheckerBrain(loadFromFile);
     winCount    = 0;
     lossCount   = 0;
     gamesPlayed = 0;
 }
Exemple #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);
        }
        private void InitializeAIGame()
        {
            DrawBoard(new Board());
            CheckerBrain red, black;

            red         = new CheckerBrain(true);
            black       = new CheckerBrain(true);
            currentGame = new GameInstance(black, red);
        }
        public GameInstance(CheckerBrain black, CheckerBrain red)
        {
            AIvsAI      = true;
            blackTurn   = true;
            redPlayer   = red;
            blackPlayer = black;

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