Live data from Hacker News

10 PRINT CHR$(205.5+RND(1)); : GOTO 10 (2012)

10print.org

41–50 of 62 posts

Re: 10 PRINT CHR$(205.5+RND(1)); : GOTO 10 (2012)

#41
post #39
post #18

Earlier quoted context omitted.

Should fix the line height so the lines connect to each other.

which browser doesn't show that right? chrome and firefox have connected lines for me

Firefox doesn't - but it probably falls back on system fonts for me - there the line height needs to be at around 1.15em...

Not that that helps in any way, since you never know which font might be used^^

Re: 10 PRINT CHR$(205.5+RND(1)); : GOTO 10 (2012)

#42

Why the 205.5? Why wouldn't this work as 205 + RND(1)?

RND(1) returns a value between 0 and 1, but always lower than 1. Thus, the result of 205+RND(1) will always be 205 point something, which in turn will be truncated to 205. Thus, it will always result in the same character.

Re: 10 PRINT CHR$(205.5+RND(1)); : GOTO 10 (2012)

#45

Why the 205.5? Why wouldn't this work as 205 + RND(1)?

In CBM BASIC RND(1) returned a floating point value between 0.0 (inclusive) and 1.0 (exclusive).

205 + RND(1) would always evaluate to 205 when truncated.

205.5 + RND(1) pseudo randomly selects between 205 and 206

Re: 10 PRINT CHR$(205.5+RND(1)); : GOTO 10 (2012)

#46
post #27

Lacks randomize()

I think Commodore BASIC had a more complex way of seeding the random timer: https://www.c64-wiki.com/wiki/RND 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 clock

You could also do I=RND(-TI)

Providing a neg number to RND would "reseed" the random number generator. TI was a "system" variable that updates every 60th of a second.

Re: 10 PRINT CHR$(205.5+RND(1)); : GOTO 10 (2012)

#47

Love it! Brings up so much nostalgia from the days of programming on my old TRS-80. But is it really a maze? Once you start, you don't seem to get much choice of path...

You might enjoy this game written in a single line of BASIC on a TRS-80:

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

Re: 10 PRINT CHR$(205.5+RND(1)); : GOTO 10 (2012)

#48
post #42

Why the 205.5? Why wouldn't this work as 205 + RND(1)?

RND(1) returns a value between 0 and 1, but always lower than 1. Thus, the result of 205+RND(1) will always be 205 point something, which in turn will be truncated to 205. Thus, it will always result in the same character.

I see. RND returns a float.

Re: 10 PRINT CHR$(205.5+RND(1)); : GOTO 10 (2012)

#49
Nice. This brings back some great memories. I used to do a similar one-liner that alternated between white and black blocks, which created crossword-puzzle-like patterns. I'd sit across the room and squint at the display, hoping to see some sort of emergent pattern.
Post reply on HN