Talk:Rocks (Minesweeper)/@comment-5334617-20141221223626/@comment-5334617-20141222053841

I was writing about the code, not you; I was not insulting you. I made no assumption that you didn't know what a variable is. I made the assumption that the author of the code was concerned about making it easy for others to modify (I feel justified in this assumption, given the comments I quoted above), and I pointed out that making it easier yet to modify could be accomplished with effective use of variables. I was addressing a concern already expressed in the program. Help was requested for adjusting the size of the grid, specifically, the subscript error; I took the liberty of also addressing more issues that would arise from adjusting the size, explaining at a level I considered appropriate to the state of the code.

The code appears to have two arrays,  where   and   go from 0 to 9 inclusive, and   where   and   go from 0 to 7 inclusive. To properly declare these arrays, you would use the statement.

My suggestions for changes to the code are: immediately after the  (or, very soon after) initialize the variables   (for 'X Size'),   (for 'Y Size'), and   (for 'Number of Rocks'). Put a comment by the assignment to  indicating what it is, and its maximum value (which I think will be 14, if you want to keep broadly the same screen layout), a comment by   (maximum value 10, I think), and a comment by   (maximum value  * -1 for a winnable game). Then,. Then, everywhere there are indices into the  and   arrays, relate those index values to   and   appropriately. If you didn't write the code, you'll have to study it to figure out what the appropriate relationships are.

Tip: To keep the display centered, the coordinate of the top-left square of the grid can be placed at.