Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
A jam submission

Monkey SortView game page

memory game made for PICO-1K Jam 2023
Submitted by voidgazerBon — 28 days, 2 hours before the deadline
Add to collection

Play game

Monkey Sort's itch.io page

Compressed Bytes used
992

Source Code (OPTIONAL)
function _init()
ll=1lli()s=3p="press z"
end
st=split
function lli()
m={}sts={}gt(ll)h=false
rs=time()l=st("a,b,c,d,e,f,g,h,i,j,k,l,m,n")cs=1slv=""sc=1c=1
end
function gt(n)
local vs={}
for a=1,n+2 do vs[a]=a end
for i=1,9 do
m[i]={}
for j=1,11 do
m[i][j]=0
end
end
local x
for v=1,#vs do
x=rnd(vs)ft(x)del(vs,x)
end
end
function ft(v)
local i,j=rnd(st("1,2,3,4,5,6,7,8,9")),rnd(st("1,2,3,4,5,6,7,8,9,10,11"))
if m[i][j]==0 then
m[i][j]=v
add(sts,{i,j})
else
ft(val)
end
end
function _update()
if time()-rs>5 then h=true end
if h then
if btnp(0) then
cs-=1
if cs<1 then
cs=#sts
end
end
if btnp(1) then
cs+=1
if cs>#sts then
cs=1
end
end
end
if s==1 and c<40 then
gt(ll)c+=1
elseif s==1 and c<41 then
sts={}gt(ll)c+=1
elseif s==1 then
local q=m[sts[cs][1]][sts[cs][2]]
if btnp(5) then
if sc==#sts then s=4 end
if q!=sc then s=0 end
slv..=tostr(q).." "
sc+=1
?"\a"
end
elseif s==0 or s==3 then
if btnp(4) then
_init()s=1
end
else
if btnp(4) then
ll+=1lli()s=1
end
end
end
function _draw()
cls()
if s==4 then
?"good job!\n"..p,7,59
elseif s==3 then
?"there will be numbers\ntry to memorize them\nso you can order them later\n"..p,10,49,8
elseif s==0 then
?"failed at level "..ll.."\ntry again!\n"..p,7,59
else
w=1
?"lvl "..ll,7,4,8
?"sorted: "..slv,7,109,8
?"select ⬅️➡️",7,115,6
?"confirm ❎",82,115,6
local cy,cx=sts[cs][1],sts[cs][2]
rect(7,17,120,107,8)
if h then
rect(cx*10-2,cy*10+8,cx*10+4,cy*10+16,6)
?"sort in ascending order",7,10,8
else
local t=tostr(flr(5-(time()-rs)))
?"timer: "..t,90,4,8
end
for i=1,9 do
for j=1,11 do
if m[i][j]!=0 then
if h then
?l[w],j*10,10+i*10,8
w+=1
if w>#l then w=1 end
else
?m[i][j],j*10,10+i*10,8
end
end
end
end
end
end

Leave a comment

Log in with itch.io to leave a comment.

Comments

HostSubmitted(+1)

This is a very clever entry - really pushed my memory (or lack of!)
Got to around Level 5 or 6 and kept hitting my limit.
Nice one! 😀👍