Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void MakeGuess(string guess)
- {
- for (int i = 0; i < 6; i++)
- {
- for (int j = 0; j < 6; j++)
- {
- if (board[i, j] == guess[0])
- {
- if(VerifyWord(guess,1, i, j))
- Console.WriteLine(guess + " was found! Nicely done!");
- }
- }
- }
- }
- static bool VerifyWord(string UserGuess,int i, int row, int col)
- {
- if (board[row + 1, col] == UserGuess[i])
- {
- if (i == UserGuess.Length - 1 || VerifyWord(UserGuess, i + 1, row + 1, col))
- return true;
- }
- if (board[row - 1, col] == UserGuess[i])
- {
- if (i == UserGuess.Length - 1 || VerifyWord(UserGuess, i + 1, row - 1, col))
- return true;
- }
- if (board[row, col + 1] == UserGuess[i])
- {
- if (i == UserGuess.Length - 1 || VerifyWord(UserGuess, i + 1, row, col + 1))
- return true;
- }
- if (board[row, col - 1] == UserGuess[i])
- {
- if (i == UserGuess.Length - 1 || VerifyWord(UserGuess, i + 1, row, col - 1))
- return true;
- }
- return false;
- }
Add Comment
Please, Sign In to add comment