STARND
Author: rostok (@von_rostock / rostok.itch.io)
Category: Christmas Challenge
System: PICO-8
Language: Lua 5.2 but PICO-8 does not include the Lua standard library.
Len source code: 130
Len exe file: 65
Len code only: 69
Instructions:
1) Emulator (free)
open source.txt in your favourite editor or just use this file
copy the code into clipboard
go to https://www.pico-8-edu.com/
click on the triangle
press Esc to enter editor
press Ctrl+V to paste the code
press Esc again to exit the edior
type RUN(CLS()) to clear the screen and run the code
type this in lowercase
press Enter
wait patiently till the star is drawn
2) Actual PICO-8 emulator (propertiary)
follow steps above but instead of opening browser emulator run the app
3) Actual PICO-8 emulator (propertiary), different approach
start the emulator locally
type LOAD VC.P8.ROM end press Enter (in lowercase)
type RUN(CLS()) end press Enter
behold
Description:
The code is quite simple really, it loops endlessly generating random
asterisk coordinates that are slightly modified to make the star shape.
Here's the code:
x=rnd(9)\1*7-28y=rnd(9)\1*7-rnd({-x,x})+36x+=64?"*",x,y
run(?"*",y,x)
And explanation for unpacked statements
-- assume that user has cleared the screen
x=rnd(9)\1*7-28 -- assign to x random value ranging from 0 to 8
-- floor it, multiply by 7 and subtract 28
y=rnd(9)\1*7-rnd({-x,x})+36 -- assign to y a similar random value
-- but also subtract OR add x
x+=64 -- add 64 to x to center the star on screen
?"*",x,y -- print asterisk at x,y coordinates
-- ? is a shorthand for print function and
-- forces a newline
run(?"*",y,x) -- again on y,x position and start over
-- run may take argument but this is actually
-- strange that syntax allows ? shorthand here
-- the first print draws a rectangle with
-- small incisions on shorter sides
-- second print is for transposition
Comments:
This archive and source length
------------------------------
source.txt - source without 3 line header
vc3-2022-32-5-69.p8 - source code with PICO8 header
vc.p8.rom - packed PICO-8 ROM
vc3-2022-32-5-69.png - screenshot
source.png - source screenshot from VC as PICO doesn't wrap lines
As there are 3 files with various length I would like to explain that in
my personal opinion bare source code (69 bytes for this submission)
should be taken for PICO-8 ranking. ROMs are really just a packed source,
with quite hard trial and error sizecoding that focuses on statement
rearraning. As for p8 files - their header, consisting of 3 lines, isn't
even showed in the console's editor.
On the other hand, recent PICO1k jam rules focused on ROM file length only.
PICO-8
------
PICO-8 is a virtual machine that has look and feel of 80s game consoles.
It's screen has a resolution of 128x128 pixels and displays 16 colors.
Memory is limited to 64kb however Lua variables & code are separate and
limited to 2MB. PICO-8 CPU is also limited with each instruction having
a specific number of cycles.
To see some interesting PICO-8 sizecoding creations follow #tweetcart tag
on Twitter. This tag is often associated with a single tweet long code
(280 chars) focused on making various demo effects.