|
if false then |
|
--[[rename::⬅️]]sc=0 |
|
--[[rename::😐]]cx0=0 |
|
--[[rename::⌂]]cy0=0 |
|
--[[rename::♪]]cx1=0 |
|
--[[rename::♥]]cy1=0 |
|
--[[rename::z]]z=nil |
|
--[[rename::s]]vs=nil |
|
--[[rename::n]]sum=nil |
|
--[[rename::d]]tm=nil |
|
--[[rename::e]]rm=nil |
|
--[[rename::x]]mx=nil |
|
--[[rename::y]]my=nil |
|
-- [[rename::f]]my2=nil |
|
--[[rename::p]]x0=nil |
|
--[[rename::q]]y0=nil |
|
--[[rename::w]]av=nil |
|
--[[rename::u]]x=nil |
|
--[[rename::v]]y=nil |
|
--[[rename::c]]_8=nil |
|
--[[rename::g]]prt=nil |
|
--[[rename::a]]nil2=nil |
|
end |
|
-- srand(1284) |
|
|
|
|
|
z={}_8=-8vs=0 |
|
prt="\^!5f58\x05\x64\x38\x22\xff" --no btn repeat + print attrs: default wide, (normal width/heights), offset printing by (2,2), !! no btnp repeat |
|
::--[[rename::_]]_:: |
|
|
|
?'\^1\^c0\^!5f2d3' |
|
|
|
rm=1 --1 dont remove, 0 remove |
|
mx=stat(32) --after flipcls, and after mouse-poke |
|
my=stat(33) |
|
if btn(5) do |
|
my2=mid(16,96,my) -- edit my right before we throw it away (later in this if) |
|
-- if (btn(5) and x0==0)... (note: awkward when you literally click at x=0) |
|
if (btnp(5)) x0=mx y0=my2 ?"\ai6v1c1" --start click |
|
-- |
|
-- continue dragging |
|
cx0=_8&min(mx,x0) |
|
cy0=_8&min(my2,y0) |
|
cx1=_8&max(mx,x0) |
|
cy1=_8&max(my2,y0) |
|
elseif x0 do |
|
-- released mouse |
|
x0=nil2 |
|
if (sum==_8) rm=0?"\ai7f1a" |
|
-- this comment is required; https://www.lexaloffle.com/bbs/?tid=142148 |
|
-- (not required post-shrinko8 b/c the comments/whitespace are removed) |
|
end?prt,tm |
|
-- pqn(cx0,cy0,cx1,cy1,x0,y0) |
|
|
|
-- calculate sum / remove numbers |
|
sum=2 -- count down from 2 to -8 |
|
for --[[rename::i]]i=32,207do |
|
av=z[i]or rnd(9)\1+1 --randomize map area |
|
x=i%16*8 |
|
--y=i\16*8 |
|
y=_8 & i\2 |
|
-- if x-cx0|cx1-x|y-cy0|cy1-y|av-1>0 do --fruitbox scoring |
|
if x-cx0|cx1-x|y-cy0|cy1-y>0 do |
|
av*=rm |
|
-- sc-=rm-1 --last char free b.c digit (but no good anymore b/c no overtime prevention) |
|
sum-=av |
|
|
|
-- ➡️ rm | sc+= |
|
---------------- |
|
-- 1 1 | 0 |
|
-- 1 0 | 1 |
|
-- 0 1 | 0 |
|
-- 0 0 | 0 |
|
sc+=➡️&~rm |
|
end |
|
z[i]=av |
|
?av,x,y,av |
|
end?'\^jc1\fcscore '..vs |
|
|
|
-- selection ants |
|
if(x0) rect(cx0,cy0,cx1+9,cy1+8) --brittle: color from score |
|
|
|
--timer |
|
tm=128-t() -- 125 |
|
rectfill(-1,107,tm,113) --brittle: color from score |
|
if(tm==0)➡️=0prt="\^j8rtime up!"?"\av3fg" |
|
-- |
|
|
|
|
|
--score |
|
if(vs<sc)vs+=1?"\ax5v3c0" |
|
-- |
|
|
|
-- \^.ᶠᶠ⁷⁷³³¹¹ -- corner triangle |
|
-- \^.¹¹³³⁷⁷ᶠᶠ -- mouse-ish triangle |
|
-- \^.¹³⁷ᶠ³⁴\0\0 -- og mouse -- nulls costs 2 extra |
|
?'\^.¹³⁷ᶠ³⁴\0\0',mx-2,my-2,7 --mouse |
|
-- pset(mx,my,8) |
|
|
|
-- if (btnp(6)) run() --anticheat - pause = reroll |
|
-- nil3=btnp(6)and run() |
|
|
|
|
|
-- if btnp(4) then sc+=100 end --check that score right before timeout counts |
|
-- do_toast() -- pqn |
|
|
|
goto _ |
|
|
|
|
|
--[[ (old?) psuedocode |
|
|
|
score = 0 |
|
make random map, each cell 1-9 |
|
loop: |
|
if from: |
|
if not click: |
|
-- release |
|
sum = 0 |
|
elseif click: |
|
from = mouse |
|
|
|
for x,y,val in map: |
|
draw val --including 0, but 0 adds 0 to score and is color 0, so it's fine |
|
if x,y inside (from,mouse) and val>0: |
|
if sum: |
|
sum += val |
|
if rm: |
|
mset(x,y,0) |
|
score += 1 |
|
|
|
if rm: |
|
rm,from = nil |
|
if sum: |
|
rm = sum==10 -- rm 0: remove rm 1: dont remove |
|
sum = nil |
|
|
|
draw mouse |
|
draw fence |
|
draw score |
|
|
|
]] |
|
|
|
|
|
|
|
--[[ new loop, to fix mobile clicking |
|
|
|
need both: |
|
|
|
compute sum |
|
move mouse |
|
//flip |
|
delete og area, not new area |
|
|
|
move mouse |
|
click immediately (mobile) |
|
//flip |
|
select starting from new mouse, not old mouse |
|
|
|
|
|
::_:: |
|
|
|
del=false |
|
if btn then |
|
mx,my = mouse() |
|
my2 = clamp my |
|
if (btnp) x0,y0 = mx,my2 |
|
cx0 ... cy1 = min/max(mx/my2/x0/y0) |
|
else |
|
if x0 then |
|
x0=nil |
|
if (sum==10) del=true |
|
end |
|
end |
|
|
|
remove nums in bounds iff del is true (rm==0) |
|
sum=... |
|
|
|
goto _ |
|
--]] |
|
|
|
|
|
|
|
--[[ (old) timeline |
|
|
|
frame# event start vars mid loop end vars |
|
---------------------------------------------------------------------- |
|
n click cl=1 x0 cxy=old cxy |
|
n+1 release cl=0 x0 cxy sum=0 sum=10 rm |
|
n+2 cl=0 [x0] cxy sum=0 rm (mset) |
|
|
|
ahhh need to set x0 nil later b/c it resets sum on the rm loop... |
|
bug: can change selection after rm has been set... (fixed? can't trigger it) |
|
|
|
]] |