public bool MakeTurn() { if (next_player) { Console.WriteLine("Turn: " + (turn++).ToString()); } Board.PrintBoard(board); List <ulong> AllowedMoves = null; if (Board.CurrentPlayerHasLessThanThree(board) || (AllowedMoves = Board.GetMoves(board)).Count == 0) { // Current player has lost if (next_player) { Console.Write("Black"); } else { Console.Write("White"); } Console.WriteLine(" Wins!"); return(false); } while (true) { ulong move; if (next_player) { move = White.GetMove(board); } else { move = Black.GetMove(board); } // ensure move is valid foreach (var allowed_move in AllowedMoves) { if (allowed_move == move) { next_player = !next_player; DumpMove(board, move); board = move; return(true); } } // move is invalid if (next_player) { White.IllegalMove(move); } else { Black.IllegalMove(move); } // request again } }