Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: An Event Sourced Minesweeper (dfarr.github.io)
84 points by david-farr on Feb 18, 2021 | hide | past | favorite | 24 comments



I passed my time in lockdown creating an Event Sourced version of the classic game Minesweeper! Be sure to try out the slider after a few moves, or if you click on mine.

Check out the code here: https://github.com/dfarr/minesweeper

I also wrote a blog post: https://dfarr.medium.com/event-sourcing-minesweeper-65f0d497...


Probably the blog post should be the linked article?


hey mate, a bit random question, but did you edit your post to add the links?


yes


This just made me realise that the way chess games are written down (move after move, using the strict minimum amount of information) actually is Event Sourced.

Quite funny. So, thank you!


Indeed! That would be a really fun project to create as well, though much more involved.


Really fun to finish and draw the slider backwards. Revealed a spiral pattern I didn't realize I was doing!


I was playing a quick game, clicked a mine and it was impossible for it to be a mine based on the numbers. I was about to screenshot and post it here when I realized that I had scrolled to perfectly hide the bottom row of the game, which changed everything.

There's another HN post right now about a UI problem costing Citibank $500M. It seems like this is somewhat related in my mind. If the application had made clear to me somehow that I wasn't seeing all of the information I needed to see, I wouldn't have failed. Not that it matters in this case. Just an example of how common these sorts of problems are, and how hard it would be to find and prevent all of them.


The perils of hiding the scrollbar by default (and also using a fixed:bottom element). I feel the modern push for clean design sometimes goes too far - removing the scrollbar definitely being one of those instances.


Feedback: You should add one notch on the progress bar for every step so you can visually see that every move adds another step you can move back to.


Really nice implementation! I did tried to make simple game using JavaScript ES6 2 years back. It was really fun and learned JavaScript concepts to implement this. https://magnetomax.github.io/MineSweeper/


This is awesome! I love the use of emojis right in the source code - I did the same


Yours is a bit more fun to play as it allows right-clicking on the flags to uncover surrounding fields.

Both are cool stuff and nice learning experiments though!


Oh, it's in Elm. Cool! I'll definitely read the code later today and hopefully learn something. Did writing this reveal any interesting pros/cons regarding event sourcing in contrast to a stateful implementation?

Minesweeper is such a cool exercise when learning new stuff. A co-worker challenged me to write this crude implementation on a flight from Heathrow to NYC while I was learning Go: https://gitlab.com/joyey/kakkamiina


I may have found a little bug. Sometimes when you win the last mines don't get a flag: https://imgur.com/a/xLcNZ0X. My last move was to right-click on the 2 in the bottom left.

Also, right clicking on borders sometimes pops up a context menu.


That's no bug, flags are strictly placed by the player.


One of the fun side games I've been playing is to try to beat the game with the fewest possible events, which means not flagging squares - it's definitely much harder!


Nice, I love Minesweeper. By the way, the link to your blog post is incorrect in your README.


Whoops, fixed! Thank you


Awesome! Love the look and the blog post. But a feature request: a timer!


I imagine there are a variety of ways to implement a timer where you can go back in time...


That's definitely the crux of the problem! Although it would be cool to see the clock go backwards when you drag the slider, it's probably more accurate to keep the clock counting up so it reflects the overall time it takes to complete the game.


This is really awesome! Very fun to play. UI Looks good as well.


I just played it. Works smoothly.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: