Commodore 64: Never Ending Maze
#1
While roaming around RetroGameCoding.org where Bplus and Cybermonkey roam, I came across a thread that where Mr. SQL shared a link to an article on Time.com titled, "Fifty Years of BASIC, the Programming Language That Made Computers Personal". You can see the page at http://time.com/69316/basic/

In the article, which is fairly long, there was an animated *.GIF of an endless maze on the Commodore 64 created in one line of code. Here is a screenshot of that *.GIF:



Here is the actual animated *.GIF



I thought it would be to recreate the animation in QB64 and have it look like the Commodore 64 version as seen in the screenshot. While I could get close to the Commodore 64 version, there are some minor differences. However, this is a representation of the animated .GIF, not an exact duplicate, and I had no intentions of making it identical.

Here are a couple screenshots of my demo:




Here is the code to the demo:

Code:
DIM SHARED MainWindow AS LONG
DIM SHARED Commodore64Screen AS LONG


MainWindow = _NEWIMAGE(768, 496, 32)
Commodore64Screen = _NEWIMAGE(320, 200, 32)

SCREEN MainWindow
_TITLE "TJP - Commodore 64: Never Ending Maze - version #1"

_FONT 8
CLS , _RGB32(112, 91, 207)

_DEST Commodore64Screen

CLS , _RGB32(52, 30, 149)
COLOR _RGB32(112, 91, 207), _RGB32(52, 30, 149)

_FONT 8

LOCATE 2, 5

PRINT "**** COMMODORE 64 BASIC V2 ****"
PRINT
PRINT " 64K RAM SYSTEM  38911 BASIC BYTES FREE"
PRINT
PRINT "READY."

CursorX = POS(0)
CursorY = CSRLIN

PRINT CHR$(219);

DisplayScreen

SLEEP 2

LOCATE CursorY, CursorX

DO

    _LIMIT 30

    IF c < 3 THEN c = c + 1

    SELECT CASE c

        CASE 1

            cPRINT "10 PRINT CHR$(205.5+RND(1));:GOTO 10"
            CursorX = POS(0)
            CursorY = CSRLIN
            PRINT CHR$(219);
            DisplayScreen
            LOCATE CursorY, CursorX
            SLEEP 1

        CASE 2

            cPRINT "RUN"
            CursorX = POS(0)
            CursorY = CSRLIN
            PRINT CHR$(219);
            DisplayScreen
            LOCATE CursorY, CursorX
            SLEEP 1

        CASE 3

            FOR i = 1 TO 13
                PRINT MID$("/\", RND * 2 + 1, 1);
            NEXT

    END SELECT

    DisplayScreen

    k& = _KEYHIT

LOOP UNTIL k& = 27

PRINT
PRINT "BREAK IN 10"
PRINT "READY."
PRINT CHR$(219);

DisplayScreen

SLEEP

SYSTEM

SUB cPRINT (Message AS STRING)

    DIM CursorX AS INTEGER
    DIM CursorY AS INTEGER
    DIM LimitAmount AS _UNSIGNED _BYTE

    CursorX = POS(0)
    CursorY = CSRLIN

    LimitAmount = 8

    _LIMIT LimitAmount

    PRINT CHR$(219);

    DisplayScreen

    FOR i = 1 TO LEN(Message)
        LOCATE CursorY, CursorX

        _LIMIT LimitAmount
        PRINT MID$(Message, i, 1);

        CursorX = POS(0)
        CursorY = CSRLIN

        PRINT CHR$(219);

        DisplayScreen

    NEXT

    LOCATE CursorY, CursorX

    _LIMIT LimitAmount

    PRINT " "

    DisplayScreen

END SUB


SUB DisplayScreen ()

    _PUTIMAGE (64, 48)-(704, 448), Commodore64Screen, MainWindow
    _DISPLAY

END SUB

Talk about the good ole days!
Reply
#2
Amazing!
B += x
Reply
#3
@bplus,

What do you find amazing about it?
Dedicated to empowering computer programming hobbyists, tinkerers, amateurs, and enthusiasts.
profile for Walter Whitman at Stack Overflow, Q&A for professional and enthusiast programmers


Reply
#4
It's a one-liner! and it's A MAZE Big Grin

Actually praising a one-liner with one word is a bit extravagant.

True, in a real maze you might be able to find a way to get there from here.
B += x
Reply
#5
Oh I did find this in my SmallBASIC files:

Code:
for i in seq(0, 480000, 480000) do pset i mod 800, i\800, 15 * ( ((i mod 800) XOR 2 + (i\ 800) XOR 2) MOD 7<>0)

I can't remember if this will help with Aurel's electrical current densities on mental surfaces or ham operators pick up signals from Orion's belt?


Attached Files Thumbnail(s)

B += x
Reply