Minesweeper Dev C++

Posted on by

I'm doing this minesweeper assignment and I need help. I tried to test the findMineValues() function and it completely scrambles up my board. Can someone help me pinpoint what I am doing wrong?

Minesweeper Online

  • 2 Contributors
  • forum 5 Replies
  • 914 Views
  • 14 Hours Discussion Span
  • commentLatest Postby DeadJusticeLatest Post

VernonDozier2,218

Minesweeper in c. Contribute to mukund26/minesweeper development by creating an account on GitHub. May 17, 2013 Minesweeper game project. Hello, I have just joined this community, wanting to be better in programming using c. About minesweeper.can't really recall. Oct 27, 2009  The C Program: minesweeper.cpp 1 /. 2. minesweeper.cpp 3. 4. Created on: Oct 27, 2009 5. Author: Brianna 6./ 7 8 #include 9 #include 10 #. Minesweeper c free download. Eagle Mode Eagle Mode is a zoomable user interface (ZUI) with file manager, file viewers, games, and more.

Dev C++ For Windows 10

Please be more specific about what the problem is. What is this function supposed to do and what does 'it completely scrambles up my board' mean?

Right now it doesn't do anything as far as I can tell. You have a void function that declares and changes a local variable called numMines , then never does anything with numMines . You have a function call that DOES do something with numMines , but it is commented out.

Minesweeper Dev C++

As a side note, on lines like this:

Griddles, cookers, gas stands, ovens and tons of utensils like pots, pans, plates, knives, spatulas and blenders! There’s also a full set of spices and herbs for adding that extra flavour!Lifelike cooking experience! Download cooking. On top of that there are over 120 ingredients available in the pantry: meat and fish, fruit and veggies, dairy products and various liquids.

you can leave true off and it'll be the same code.

Dev C++ Online

  1. {
  2. int theone;
  3. int extra2=0;
  4. char char2;
  5. char flag='n';
  6. int x;
  7. int count=30;
  8. srand (time(NULL));
  9. vector<char>cover;
  10. vector<int>waiter;
  11. vector<char>chars;
  12. for(int i=0;i<261;i++)
  13. waiter.push_back(0);
  14. mines.push_back(0);
  15. cover.push_back('+');
  16. cout<<'n';
  17. {
  18. y=x%260+1;
  19. if(mines[y]0)
  20. mines[y]=1;
  21. else
  22. i--;
  23. }
  24. {
  25. chars[i]='M';
  26. x=0;
  27. if(chars[1]!='M') //top left
  28. if(chars[2]'M')
  29. nums[1]++;
  30. if(chars[27]'M')
  31. nums[1]++;
  32. if(chars[28]'M')
  33. nums[1]++;
  34. }
  35. if(chars[26]!='M') //top right
  36. if(chars[25]'M')
  37. nums[26]++;
  38. if(chars[51]'M')
  39. nums[26]++;
  40. if(chars[52]'M')
  41. nums[26]++;
  42. }
  43. if(chars[235]!='M') //bottom left
  44. if(chars[209]'M')
  45. nums[235]++;
  46. if(chars[210]'M')
  47. nums[235]++;
  48. if(chars[236]'M')
  49. nums[235]++;
  50. }
  51. if(chars[260]!='M') //bottom right
  52. if(chars[233]'M')
  53. nums[260]++;
  54. if(chars[234]'M')
  55. nums[260]++;
  56. if(chars[259]'M')
  57. nums[260]++;
  58. }
  59. for(int i=2;i<26;i++) //top
  60. if(chars[i]!='M')
  61. if(chars[i-1]'M')
  62. if(chars[i+1]'M')
  63. if(chars[i+25]'M')
  64. if(chars[i+26]'M')
  65. if(chars[i+27]'M')
  66. }
  67. {
  68. {
  69. nums[i]++;
  70. nums[i]++;
  71. nums[i]++;
  72. nums[i]++;
  73. nums[i]++;
  74. }
  75. for(int i=26;i<210;i++) //left
  76. if(i%261&&chars[i]!='M')
  77. if(chars[i-26]'M')
  78. if(chars[i-25]'M')
  79. if(chars[i+1]'M')
  80. if(chars[i+26]'M')
  81. if(chars[i+27]'M')
  82. }
  83. {
  84. {
  85. nums[i]++;
  86. nums[i]++;
  87. nums[i]++;
  88. nums[i]++;
  89. nums[i]++;
  90. }
  91. for(int i=28;i<234;i++) //all else
  92. if(i%26!=0&&i%26!=1&&chars[i]!='M')
  93. if(chars[i-27]'M')
  94. if(chars[i-26]'M')
  95. if(chars[i-25]'M')
  96. if(chars[i-1]'M')
  97. if(chars[i+1]'M')
  98. if(chars[i+25]'M')
  99. if(chars[i+26]'M')
  100. if(chars[i+27]'M')
  101. }
  102. {
  103. chars[i]='1';
  104. chars[i]='2';
  105. chars[i]='3';
  106. chars[i]='4';
  107. chars[i]='5';
  108. chars[i]='6';
  109. chars[i]='7';
  110. chars[i]='8';
  111. while(1)
  112. cout<<'nnMines left: '<<count<<'nn a b c d e f g h i j k l m n o p q r s t u v w x y zn ---------------------------------------------------n 0 ';
  113. for(int i=0;i<260;i++)
  114. if(cover[i+1]'+')
  115. else
  116. if(i%2625&&num!=10)
  117. cout<<' '<<num-1<<'n '<<num<<' ';
  118. }
  119. }
  120. cout<<' 9n ---------------------------------------------------n a b c d e f g h i j k l m n o p q r s t u v w x y z';
  121. cout<<'nnChoose a space: ';
  122. if(char1'F')
  123. cin>>char3;
  124. char2=char3;
  125. count--;
  126. wait=1;
  127. extra1=1;
  128. extra1=2;
  129. extra1=3;
  130. extra1=4;
  131. extra1=5;
  132. extra1=6;
  133. extra1=7;
  134. extra1=8;
  135. extra1=9;
  136. extra1=10;
  137. extra1=11;
  138. extra1=12;
  139. extra1=13;
  140. extra1=14;
  141. extra1=15;
  142. extra1=16;
  143. extra1=17;
  144. extra1=18;
  145. extra1=19;
  146. extra1=20;
  147. extra1=21;
  148. extra1=22;
  149. extra1=23;
  150. extra1=24;
  151. extra1=25;
  152. extra1=26;
  153. if(char2'0')
  154. else if(char2'1')
  155. else if(char2'2')
  156. else if(char2'3')
  157. else if(char2'4')
  158. else if(char2'5')
  159. else if(char2'6')
  160. else if(char2'7')
  161. else if(char2'8')
  162. else if(char2'9')
  163. if(flag'y')
  164. chars[theone]='F';
  165. cover[theone]='-';
  166. waiter[wait]=theone;
  167. while(wait!=0&&flag'n')
  168. if(chars[theone]'0')
  169. if(theone1) //top left
  170. {
  171. waiter[wait]=2;
  172. cover[2]='-';
  173. {
  174. waiter[wait]=27;
  175. cover[27]='-';
  176. {
  177. waiter[wait]=28;
  178. cover[28]='-';
  179. if(theone26&&cover[26]'+') //top right
  180. if(nums[25]0&&cover[25]'+')
  181. wait++;
  182. }
  183. if(nums[51]0&&cover[51]'+')
  184. wait++;
  185. }
  186. if(nums[52]0&&cover[52]'+')
  187. wait++;
  188. }
  189. }
  190. {
  191. {
  192. waiter[wait]=209;
  193. cover[209]='-';
  194. if(nums[210]0&&cover[210]'+')
  195. wait++;
  196. }
  197. {
  198. waiter[wait]=236;
  199. cover[236]='-';
  200. }
  201. {
  202. {
  203. waiter[wait]=233;
  204. cover[233]='-';
  205. if(nums[234]0&&cover[234]'+')
  206. wait++;
  207. }
  208. {
  209. waiter[wait]=259;
  210. cover[259]='-';
  211. }
  212. {
  213. {
  214. {
  215. waiter[wait]=i-1;
  216. cover[i-1]='-';
  217. {
  218. waiter[wait]=i+1;
  219. cover[i+1]='-';
  220. {
  221. waiter[wait]=i+25;
  222. cover[i+25]='-';
  223. {
  224. waiter[wait]=i+26;
  225. cover[i+26]='-';
  226. {
  227. waiter[wait]=i+27;
  228. cover[i+27]='-';
  229. }
  230. for(int i=236;i<260;i++) //bottom
  231. if(theonei)
  232. if(nums[i-1]0&&cover[i-1]'+')
  233. wait++;
  234. }
  235. {
  236. waiter[wait]=i+1;
  237. cover[i+1]='-';
  238. if(nums[i-25]0&&cover[i-25]'+')
  239. wait++;
  240. }
  241. if(nums[i-26]0&&cover[i-26]'+')
  242. wait++;
  243. }
  244. if(nums[i-27]0&&cover[i-27]'+')
  245. wait++;
  246. }
  247. }
  248. for(int i=26;i<210;i++) //left
  249. if(i%261&&theonei)
  250. if(nums[i-26]0&&cover[i-26]'+')
  251. wait++;
  252. }
  253. if(nums[i-25]0&&cover[i-25]'+')
  254. wait++;
  255. }
  256. {
  257. waiter[wait]=i+1;
  258. cover[i+1]='-';
  259. {
  260. waiter[wait]=i+26;
  261. cover[i+26]='-';
  262. {
  263. waiter[wait]=i+27;
  264. cover[i+27]='-';
  265. }
  266. {
  267. {
  268. {
  269. waiter[wait]=i-27;
  270. cover[i-27]='-';
  271. {
  272. waiter[wait]=i-26;
  273. cover[i-26]='-';
  274. {
  275. waiter[wait]=i-1;
  276. cover[i-1]='-';
  277. {
  278. waiter[wait]=i+25;
  279. cover[i+25]='-';
  280. {
  281. waiter[wait]=i+26;
  282. cover[i+26]='-';
  283. }
  284. {
  285. {
  286. {
  287. waiter[wait]=i-27;
  288. cover[i-27]='-';
  289. {
  290. waiter[wait]=i-26;
  291. cover[i-26]='-';
  292. {
  293. waiter[wait]=i-25;
  294. cover[i-25]='-';
  295. {
  296. waiter[wait]=i-1;
  297. cover[i-1]='-';
  298. {
  299. waiter[wait]=i+1;
  300. cover[i+1]='-';
  301. {
  302. waiter[wait]=i+25;
  303. cover[i+25]='-';
  304. {
  305. waiter[wait]=i+26;
  306. cover[i+26]='-';
  307. {
  308. waiter[wait]=i+27;
  309. cover[i+27]='-';
  310. }
  311. }
  312. theone=waiter[wait];
  313. }
  314. }