Show HN: MineSweeper implemented in 100% CSS and HTML – no JavaScript
1–10 of 97 posts
Re: Show HN: MineSweeper implemented in 100% CSS and HTML – no JavaScript
#2I linked to the README since any web devs that see this will probably want to know how buuut here's a link to the game if you want to go hands on:
https://propjockey.github.io/css-sweeper/#randommenu
It's all open source, and I discuss some details of how to do it in that readme, but I am more than happy to answer any questions!
Thanks for checking it out!
Re: Show HN: MineSweeper implemented in 100% CSS and HTML – no JavaScript
#3Re: Show HN: MineSweeper implemented in 100% CSS and HTML – no JavaScript
#4And also, what causes the lack of responsiveness?
Re: Show HN: MineSweeper implemented in 100% CSS and HTML – no JavaScript
#5Very interesting! Can I ask, how did you implement the timer in CSS/HTML? And also, what causes the lack of responsiveness?
Here's the part that controls when the animation is running:
#level-none:not(:checked) ~ #ram #timer::before {
animation: timer step-end 1;
animation-duration: 999s;
animation-fill-mode: forwards;
--pause-if-won: var(--win-state) paused;
--pause-if-lost: var(--game-over) paused;
--pause-if-randommenu: var(--randommenu-visible) paused;
animation-play-state: var(--pause-if-won, var(--pause-if-lost, var(--pause-if-randommenu, running)));
}
Though the design is responsive to the width of the window, I suspect you mean how slow it is: it's 1.23MB of HTML + CSS, and clicking anything causes almost everything to redraw. It's only a little laggy on my computer but the idea was to test the limits of what's possible and is expected! :)Thank you for checking it out!
Re: Show HN: MineSweeper implemented in 100% CSS and HTML – no JavaScript
#6That's crazy! The large lag between clicking and the UI updating is slightly annoying, but that's just me nitpicking at something other than the cool technical feat.
Re: Show HN: MineSweeper implemented in 100% CSS and HTML – no JavaScript
#7That's crazy! The large lag between clicking and the UI updating is slightly annoying, but that's just me nitpicking at something other than the cool technical feat.
yeah, i expected it to be instant to be honest, given it's just markup and there's no "thinking"
Re: Show HN: MineSweeper implemented in 100% CSS and HTML – no JavaScript
#8Re: Show HN: MineSweeper implemented in 100% CSS and HTML – no JavaScript
#9Re: Show HN: MineSweeper implemented in 100% CSS and HTML – no JavaScript
#10Earlier quoted context omitted.
yeah, i expected it to be instant to be honest, given it's just markup and there's no "thinking"
It's 1.23MB of CSS & HTML - this is meant to be a stress test of the limits, lag is expected for the next several years of average-at-the-time computers!