Hi,

I'll need to look at the code again, but I believe the entire playfield I 
stored in a matrix array.

I also declared two arrays(long enough to represent every cell) to act as a 
stack(sort of). There are two counting integers also, for Read and Write. When 
you check a cell, it marks the cell as "Checked". It then stores the x and y 
positions of the cell to the X and Y stack arrays. Finally it increments the 
Write count.

Then it goes to the actual "checking" part of the program. If Read<Write, that 
means we have some cells that need to be checked. It fetches the X and Y from 
the stack(position comes from Read variable). Then the Read count is 
incremented by one.

It does the actual revealing of the cell here. If there are mines it shows the 
number of mines nearby. If there are no mines, it adds each neighboring cell to 
the stack(if the cell hasnt already been checked). Then it goes back to the 
check. It will continue on until Read=Write. When Read=Write, we know that the 
stack has no unchecked cells in it, and control is returned to the player.

I can go in on Sunday and comment the code if you'd like. There are already 
some comments explaining which cells are being checked, but they are very 
limited.

~George

> On Jun 2, 2017, at 5:40 PM, John R. Hogerhuis <[email protected]> wrote:
> 
> George, I'm curious could you talk a little bit about the "reveal" algorithm 
> in text sweeper? Which lines of code do it and how it works?
> 
> Thanks,
> 
> -- john.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to