Esempio n. 1
0
 private AvailableMove selectMove(List<AvailableMove> allMovesList, Piece[,] board, ref bool mate, string colour)
 {
     AvailableMove move = new AvailableMove();
     if (allMovesList.Count > 0)
     {
         var maxRating = allMovesList.Max(x => x.Rating);
         move = allMovesList.Where(x => x.Rating == maxRating).First();
     }
     else if (cf.isThreatened(uf.FindKing(colour, board), uf.OtherColour(colour), board))
     {
         df.Checkmate(colour);
         mate = true;
     }
     else
     {
         df.Stalemate();
         mate = true;
     }
     return move;
 }