Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

13
Trying to write a Minesweeper reveal algorithm but I can't get it to work
Post Body

I'm working on a minesweeper style game and I'm trying to implement the algorithm used to reveal tiles. Theoretically, it should be relatively simple:

On click, reveal a tile. If the tile has 0 adjacent mines, run the same code on its neighbors, checking if they all have 0 mines and causing them to reveal their neighbors and so on.

I feel this code should be sufficient, but I get an infinite loop error whenever I run it.

I genuinely don't know what's causing the issue, here. Could it be the way I get the surrounding tiles?

Author
Account Strength
100%
Account Age
6 years
Verified Email
Yes
Verified Flair
No
Total Karma
9,894
Link Karma
5,368
Comment Karma
4,452
Profile updated: 3 days ago
Posts updated: 18 hours ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
6 months ago