Advertisement
Guest User

Untitled

a guest
Feb 28th, 2015
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. static int CountMinesLeft(string[,] board, string[,] visibilityArray, int count)
  2. {
  3. if (visibilityArray.Length == 81)
  4. {
  5. count = 10;
  6. }
  7. else if (visibilityArray.Length == 256)
  8. {
  9. count = 40;
  10. }
  11. else if (visibilityArray.Length == 480)
  12. {
  13. count = 99;
  14. }
  15.  
  16. for (int i = 0; i < board.GetLength(0); i++)
  17. {
  18. for (int p = 0; p < board.GetLength(1); p++)
  19. {
  20.  
  21. if (visibilityArray[i, p] == "2")
  22. {
  23. count--;
  24. }
  25.  
  26. }
  27. }
  28. return count;
  29. }
  30.  
  31. static int CountMinesLeft(string[,] board, string[,] visibilityArray, ref int anotherCount)
  32. {
  33. if (visibilityArray.Length == 81)
  34. {
  35. anotherCount = 10;
  36. }
  37. else if (visibilityArray.Length == 256)
  38. {
  39. anotherCount = 40;
  40. }
  41. else if (visibilityArray.Length == 480)
  42. {
  43. anotherCount = 99;
  44. }
  45.  
  46. int count = anotherCount;
  47. for (int i = 0; i < board.GetLength(0); i++)
  48. {
  49. for (int p = 0; p < board.GetLength(1); p++)
  50. {
  51.  
  52. if (visibilityArray[i, p] == "2")
  53. {
  54. count--;
  55. }
  56. }
  57. }
  58. return count;
  59.  
  60. int anotherCount = 0;
  61. int count = CountMinesLeft(board, visibilityArray, ref anotherCount);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement