I was practicing extreme optimization and came up with this cart
There's not a lot to see here but what matters is that it works
Edit:The original took up 182 characters, this new version takes up only 176 characters
Edit2:Thanks to @p01, the new version takes up 133 characters. Unfortunately, not all the techniques
could be implemented without problems as racer 5 was the only one that could win in your code
Edit3:I was able to make the cart smaller by 3 characters which is not that bad
Fun challenge to squeeze a 5 CPU race.
Using p8scii to wait 1 frame and clear the screen, a simpler array, and abusing the \
integer divisions to get the speed increment and winner index w
, we can squeeze quite a few bytes.
-- 126 chars \:D/ p={0,0,0,0,0}::_::?"⁶1⁶c1" for i=1,5do?"😐",p[i],i*8,10 w=p[i]\128*i p[i]+=rnd(2)\1end if(w<1)goto _ ?"racer "..w.." won",64,64 |
Really quite epic, both of you guys, @LazarevGaming and @p01. If it's possible to pause at the beginning the player until 🅾️ or ❎ is pressed, can then decide which "horse" will win the race.
Gold star material all the way !
Oh! Yes of course, @LazarevGaming, I was re-assigning w
all the time so of course only the 5th player could "win"
:p
Here's my version, it's slightly simplified visually, but any racer can win and it's just 100 characters (or 99 if you're willing to go with a black background =).
::_::?"⁶1⁶c1" for i=1,5do?"😐",@i,i*9 if(@i>120)ˇ=i poke(i,@i+rnd(2))end if(ˇ<1)goto _ ?ˇ.." won",9,9 |
That's a very clever use of POKE and PEEK, @JadeLombax. Single character for peek. Now we need a single character for POKE.
You know it wouldn't hurt Pico-8 to have some kind of stack that is accessible in PRINT and P8SCII, similar to as you have done here.
Here are special commands available for CHR(6):
[Please log in to post a comment]