Follow

As @selfsame already mentioned, yesterday I made a Minisweeper, a minimalistic version of minesweeper.

You can try it here: tilde.town/~troido/minisweeper

it currently has 254 bytes of sourcecode (including the html):

<body onload='l=i=>{s=0;for(x of[1,15,16,17])s+=(c[i+x]|0)+(c[i-x]|0)};m=240;for(i=256;i--;){c.innerHTML+=i%16?(m-=c[i]=Math.random()>.8,`<a onclick=event.target.outerHTML=c[${i}]?(alert("BOOM"),"X"):l(${i},--m||alert("=D"))||s>#</a> `):`\n`}'><pre id=c>

@selfsame @troido kinda feel like it has too many mines but maybe I just suck

@sl2c Yes, there are a lot of mines. Each tile has a 20% chance of being a mine.

With this code it is only 10%:

<body onload='l=i=>{s=0;for(x of[1,15,16,17])s+=(c[i+x]|0)+(c[i-x]|0)};m=240;for(i=256;i--;){c.innerHTML+=i%16?(m-=c[i]=Math.random()>.9,`<a onclick=event.target.outerHTML=c[${i}]?(alert("BOOM"),"X"):l(${i},--m||alert("=D"))||s>#</a> `):`\n`}'><pre id=c>

If you want something more user friendly, you could play tilde.town/~troido/minesweeper/
There you can choose the number of mines

Sign in to participate in the conversation
Tiny Tilde Website

ttw is the unofficial Mastodon instance of tilde.town. We're only smol, but we're friendly. Please don't be a dick.