142 points · by ghosthamlet · 7y ago · 60 comments
It should've been called 205.5+RND or something. Grmbl.
https://floooh.github.io/tiny8bit/c64.html?input=${wait:200}...
This rings a bell though: I remember encountering it back when I owned the machine, possibly in the BASIC manual that came with it, possibly in a magazine, or perhaps somebody at school mentioned it.
Not that that helps in any way, since you never know which font might be used^^
while true; do printf "\u$((2571 + ($RANDOM & 1)))"; doneBonus: close loops, so any two places in the maze are connected by a unique path.
As a preprocessing step, reformat the data to 77-column-long lines first, removing any whitespace characters, and discarding the last line if it is shorter than 79 characters, and then close off the exterior with solid zig-zags, like this, which are strictly added to the data (no overwriting):
╱╲╱╲╱╲...╱╲╱╲╱╲╱╲
╲╱╲╲╲╲...╲╱╱╲╱╲╱╱
╱╲╲╲╱╱...╱╲╱╱╲╱╲╲
╲╱╲╲╱╲...╲╱╲╲╱╱╲╱
: :
. .
╱╱╲╲╱╲...╱╱╲╱╲╱╲╲
╲╲╱╲╲╱...╱╱╱╲╲╱╲╱
╱╱╱╲╲╱...╱╱╱╲╱╲╱╲
╲╱╲╱╲╱...╲╱╲╱╲╱╲╱while true; do printf "\u$((2571 + ($RANDOM & 1)))"; sleep 0.02; done
while true; do printf "\xe2\x95\xb$((1 + ($RANDOM & 1)))"; done while true; do printf $(printf "\\\\u%04x" $((47 + 45 * ($RANDOM % 2)))); done for (let i=0;i<10000; i++) document.write(String.fromCharCode(9585 + Math.random()*2) + (i%100 == 99 ? '<br>':''))
const b = document.body.style;
b['font-family'] = 'Courier New';
b['font-size'] = b['line-height'] = '16px';
https://jsfiddle.net/qxjdtru6/And a fun curvy variation:
Source: http://10print.art/__repl
for(){Write-Host(Random("\","/"))-N}
https://www.youtube.com/watch?v=lWyZO-yPnvM
For anyone not familiar with the TRS-80, who finds the code somewhat weird.. the BASIC implementation was written by Microsoft. Only the first two letters of variable names were significant. Although interpreted, the ROM tokenized typed lines, meaning it didn't care about spaces.
This led to such gems as:
FORK=10 TOMATOES STEP LADDER
It's a (neat) graphic trick.
1A$="[up][down][left][right]":PRINTMID$(A$,RND(.5)4+1,1)"[left]";:FORI=1TO30:NEXT:PRINT"[rvson][space][left]";:GOTO1
205 + RND(1) would always evaluate to 205 when truncated.
205.5 + RND(1) pseudo randomly selects between 205 and 206
POKE 56328,0 : REM real-time clock activate with 1/10s -> clock runs ($DC08)
PRINT RND(0) : REM Random number addicted by timer and real-time clockProviding a neg number to RND would "reseed" the random number generator. TI was a "system" variable that updates every 60th of a second.