コード例 #1
0
        public void UpdateMinMaxValueForWin(int[] boardState)
        {
            State state = db.GetStateByBoard(boardState);

            state.stateScore = 10.0;
            state.numPlayed  = state.numPlayed + 1;
            db.UpdateState(state);
        }
コード例 #2
0
 public State[] GetPossibleMoves(int moveNum, int[] board)
 {
     if (moveNum == 1)
     {
         return(db.GetFirstMoveStates().ToArray());
     }
     else
     {
         return(db.GetPossibleMoves(db.GetStateByBoard(board)).ToArray());
     }
 }
コード例 #3
0
 public double TrainAllMoves(int[] board, int turn, int moveNum, int level)
 {
     if (level > 1)
     {
         if (HasMoveBeenPlayedBefore(db.GetStateByBoard(board).stateScore))
         {
             return(db.GetStateByBoard(board).stateScore);
         }
     }
     if (util.HasGameEnded(board, moveNum))
     {
         return(util.UpdateMinmaxValue(board, moveNum, turn * (-1)));
     }
     State[] possibleStates = util.GetPossibleMoves(moveNum, board);
     if (level % 2 == 1)
     {
         return(TrainForMaxValue(possibleStates, board, turn, moveNum, level));
     }
     else
     {
         return(TrainForMinValue(possibleStates, board, turn, moveNum, level));
     }
 }