Guest User

Untitled

a guest
Dec 11th, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. static void MakeGuess(string guess)
  2. {
  3. for (int i = 0; i < 6; i++)
  4. {
  5. for (int j = 0; j < 6; j++)
  6. {
  7. if (board[i, j] == guess[0])
  8. {
  9. if(VerifyWord(guess,1, i, j))
  10. Console.WriteLine(guess + " was found! Nicely done!");
  11. }
  12. }
  13. }
  14. }
  15.  
  16. static bool VerifyWord(string UserGuess,int i, int row, int col)
  17. {
  18. if (board[row + 1, col] == UserGuess[i])
  19. {
  20. if (i == UserGuess.Length - 1 || VerifyWord(UserGuess, i + 1, row + 1, col))
  21. return true;
  22. }
  23. if (board[row - 1, col] == UserGuess[i])
  24. {
  25. if (i == UserGuess.Length - 1 || VerifyWord(UserGuess, i + 1, row - 1, col))
  26. return true;
  27.  
  28. }
  29. if (board[row, col + 1] == UserGuess[i])
  30. {
  31. if (i == UserGuess.Length - 1 || VerifyWord(UserGuess, i + 1, row, col + 1))
  32. return true;
  33.  
  34. }
  35. if (board[row, col - 1] == UserGuess[i])
  36. {
  37. if (i == UserGuess.Length - 1 || VerifyWord(UserGuess, i + 1, row, col - 1))
  38. return true;
  39. }
  40.  
  41. return false;
  42. }
Add Comment
Please, Sign In to add comment