Beispiel #1
0
 public bool computerPlay()
 {
     if (!board.gameOver())
     {
         List <MancalaBoard> next = board.getNextPossibleBoard(1);
         int max = int.MinValue;
         foreach (MancalaBoard b in next)
         {
             int max_min = minMax(b, this.level);
             if (max < max_min)
             {
                 max   = max_min;
                 board = b;
             }
         }
     }
     return(board.repeated);
 }
Beispiel #2
0
 public int maxMin(MancalaBoard board, int level)
 {
     if (board.gameOver() || level == 0)
     {
         return(board.evaluate(1));
     }
     else
     {
         List <MancalaBoard> next = board.getNextPossibleBoard(1);
         int max = int.MinValue;
         foreach (MancalaBoard b in next)
         {
             //                if (b.repeated)
             //                    max = Integer.max(max, minMax(b, level));
             //                else
             max = Math.Max(max, minMax(b, level - 1));
         }
         return(max);
     }
 }