Play game
Minisweeper's itch.io pageCompressed Bytes used
1015
Source Code (OPTIONAL)
st,m,n,o,gx,gy=0,0,10,3,10,9
function start()
g,f,st,px,py,fl={},0,1,1,1,0
for x=1,gx do
gr={}
for y=1,gy do
add(gr,{b=false,o=false,a=0,f=false})
end
add(g,gr)
end
for b=1,n do
repeat
x=ceil(rnd(gx))
y=ceil(rnd(gy))
c=g[x][y]
until not c.b
c.b=true
for xx=x-1,x+1do
for yy=y-1,y+1do
if(xx<=gx and yy<=gy and xx>0and yy>0)g[xx][yy].a+=1
end
end
end
end
function _update()
if st==0then
if btnp(2)and m==1then
m,n,o,gx,gy=0,10,3,10,9
?"\ag2"
elseif btnp(3)and m==0then
m,n,o,gx,gy=1,36,0,16,15
?"\ag2"
end
if(btnp(4))start()
elseif st==1then
s=g[px][py]
if btnp(0)and px>1 then
?"\ag2"
px-=1
elseif btnp(1)and px<gx then
?"\ag2"
px+=1
elseif btnp(2)and py>1 then
?"\ag2"
py-=1
elseif btnp(3)and py<gy then
?"\ag2"
py+=1
end
if btnp(4)and not s.o then
s.o=true
if s.b then
?"\as7i6c2e1ca"
st=2
else
?"\ai6v1c5.c6"
end
end
if btnp(5)and not s.o then
if s.f then
?"\ag3.c"
s.f=false
fl-=1
elseif fl<n then
?"\ac3.g"
s.f=true
fl+=1
end
end
else
if(btnp(4))start()
if(btnp(5))st=0
end
end
function _draw()
cls(5)
v=0
if st==0then
for x=0,15do
for y=0,15do
grid(x*8,y*8)
end
end
b("\^w\^t minisweeper",14,39)
b("easy",56,77)
b("hard",56,85)
?"\^:0103070301000000",50,77+m*8,8
?"\^:80c0e0c080000000",69,77+m*8
b("created in 1kb for pico-1k 2024",3,121)
return
end
rectfill(0,0,128,7,0)
for x=1,gx do
xa=(x+o-1)*8
for y=1,gy do
ya=(y+o)*8
c=g[x][y]
if c.o then
rectfill(xa,ya,xa+7,ya+7,13)
if c.b then?"β",xa,ya+2,0
elseif c.a>0then
?c.a,xa+2,ya+2,0
end
else
grid(xa,ya)
if c.f then
if c.b then v+=1
if v==n and st==1then
?"\ac3.e.g.c4c4c4c4"
st=3
end
end
?"\^:000c3c3c0c000000",xa,ya,8
?"\^:0000000000040400",xa,ya,5
end
end
end
end
?fl.."/"..n,1,1,7
ppx,ppy=(px+o-1)*8,(py+o)*8
rect(ppx,ppy,ppx+7,ppy+7,12)
if st==2then
b("game over",46,49)
b("z: try again",40,65)
b("x: main menu",40,73)
elseif st==3then
b("you win!",48,49)
b("z: play again",38,65)
b("x: main menu",40,73)
end
end
function grid(x,y)
rectfill(x,y,x+7,y+7,6)
?"\^:7f01010101010100",x,y,7
?"\^:00808080808080fe",x,y,13
end
function b(t,x,y)
for xx=x-1,x+1do
for yy=y-1,y+1do
?t,xx,yy,0
end
end
?t,x,y,7
end
Leave a comment
Log in with itch.io to leave a comment.
Comments
YESSSSS I love Minesweeper. Very solid.
Itβs incredible that this game fits into the 1k limit. Fantastic, great work π.
Dang it, was doing so well (kinda!) π
(For some reason, my screenshot isn't showing? Hey ho...)
I've never been great at this, but boy I had no idea how much I relied on the "auto/flood-clearing" feature of the original - this makes it all feel much more tense! π
This is so good (+addictive) - looks and sounds spot-on.
You've done a cracking job of squeezing this all in
(even squandering precious bytes to give the jam a shout-out no less! π)
Glad you managed to get this over the line - I know it wasn't a smooth ride π
Really nice entry - congrats π
Thanks! I think the one thing it's missing is some way of guaranteeing that the first tile you click on isn't a bomb, but I just ran out of tokens. I'm still very proud that I managed to cram in as much as I did.