Colors:

Size: x Number of runs:

Animation delay: ms

Algorithm:

Mode:

Map code: "Challenge accepted." - Me, Apr 1, 3:11am

TL;DR: On a 7x7 board, each of the extreme corners (if chosen) each win ~15% of the time, blocks to either side (but not diagonal) of the corners ~3%, and the center is a distant third.

Bigger boards slightly reduce the corners' chances, smaller boards increase them. "But in one game the grass went straight to the corner" is not a counterargument, it is a anecdote, which statistics just sit back and laugh at.

v1.1: Now you can import/export boards - just copy/paste the text from/to the box. Also fixed a bug with initial position for non-square boards (thanks, erom!)

v1.2: Fixed the algorithm thanks to Lurker_IV's knowledge, added base64-based board saving with a short(ish) permalink. Also realized I wasn't accounting for ties, instead just taking the first win it came across. Fixed that.

v1.2b: Fixed the algorithm again per second_last_username's further details - now, just one grass block per turn tries to change. This eliminates the issues of ties that was fixed above. It's also much slower, but hopefully more accurate.

v1.2c: Lurker_IV has defended their original algorithm, so now you can choose between Lurker_IV's algorithm (every block has a chance to spread every turn - fast) and second_last_username's algorithm (one random block per turn spreads - slow).

Long version: So Phinq posted a reddit thread about a game his server made up based around watching grass grow. Briefly, you set up a bunch of dirt, place some grass blocks, and pick squares. The last square to be covered wins. Being Reddit, there was of course some debate as to whether the game was unbalanced, how random it was, and whether some squares were better than others. I, of course, instead of sleeping, decided that this is something that could be determined, and set out to hack out a solution.

Here are a couple sample runs I did:

Based on the wiki article that samineru pointed to
on grass growth,
this app runs "turns" - each turn, every grass block picks an adjacent (diagonal or directly adjacent) square and, if it is dirt, turns it to grass.
*(Note: this was updated in v1.2 - the new algorithm doesn't involve the "chance" box, so it was taken out.)*
You set up a "board" by clicking on the squares to rotate between dirt, grass, and non-growable block.
It defaults to the board Phinq used in his original post, with source blocks in the center of each side. Change the size and hit "Generate" to make a new board if necessary.
Then hit "run", and it will run several random simulations of the grass growing. If it's not in "Fastest" you can stop it mid-run.
You can watch it grow with the "Animate" mode, but the real analysis comes in with the
faster modes - at the end of the simulations, it totals up the averages and gives you a shaded view of the board.

The default "Avg. Time Taken" shades it according to the average number of turns it took for that square to turn to grass - more turns (brighter red) is generally* better, since it has a better chance of outlasting the rest. This metric gives a good average view for few runs.

The "Win Percentage" and "Weighted Win Percentage" show how many times each patch was the last one standing. This is more accurate in the long run, but takes more trials to get a good view of.

The bar graph indicates how many blocks fall in each division of the red shades - this was to investigate what effect changing the chance of a grass block "turning" a dirt block had on the overall effect. It seems that a greater chance of turning makes the patterns more extreme, with less middle ground, but that's not a well-analyzed metric.

The bottom line is that **there are indeed "good spots" and "bad spots" on the basic board as described in the original comment.** The corners
are the best spots, the middle is second-best, and from there it obviously gets worse as you get closer to the "source blocks".

A really dedicated grass-watcher could use this app to design more balanced boards of different shapes, different arrangements of source blocks, etc., or perhaps to weight the squares - the coners could be worth less diamonds, and the sides more, similar to other gambling games, where betting on unlikely events is risky but has a bigger payoff. With a little modification, this could even be an emulator for the game itself - allowing users to choose squares and wager on them. The possibilities are endless!

But mostly this is an idea that wormed its way into my head, and that I stayed up far to late realizing. Let me know what you think, and feel free to poke around in the source and play around with it. I also threw a copy up on jsfiddle so you can play with it that much easier.

This works on the Firefox and Chrome I tested it on, and there isn't anything too fancy, so it should be fine pretty much everywhere.

Tip if you want to run lots of trials: try different browsers. In my brief tests, Firefox does better than Chrome in Fastest mode.

Thanks to Phinq for the oroiginal post, and kayozz, 1cipere, and especially samineru for asking questions and inspiring my investigation.

*BRickAstley discovered that this isn't strictly true - center blocks, for instance, have higher average times, but not necessarily correspondingly higher win percentages. This is especially noticeable on small (3x3 playing field) boards. It makes sense in my head, but I had a hard time explaining why, so I'll leave it as a statistics exercise to the reader. Hint: I think the standard deviation of the corners is larger, and the middle has a much more normal distribution.