10 Line BASIC Competition 2022!

Everything related to BASIC version 1.x (Oric 1 and Atmos) or HYPERBASIC (Telestrat).
Don't hesitate to give your small program samples, technical insights, or questions...
User avatar
Symoon
Archivist
Posts: 2310
Joined: Sat Jan 14, 2006 12:44 am
Location: Paris, France

Re: 10 Line BASIC Competition 2022!

Post by Symoon »

:shock:

If I'm not mistaken, the syntax NEXTL,G isn't even described in the Oric manuals.
User avatar
Chema
Game master
Posts: 3019
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: 10 Line BASIC Competition 2022!

Post by Chema »

Amazing!
User avatar
Xeron
Emulation expert
Posts: 426
Joined: Sat Mar 07, 2009 5:18 pm
Contact:

Re: 10 Line BASIC Competition 2022!

Post by Xeron »

Incredible! 😳👍
User avatar
kenneth
Squad Leader
Posts: 516
Joined: Fri Nov 26, 2010 9:11 pm
Location: France PdD
Contact:

Re: 10 Line BASIC Competition 2022!

Post by kenneth »

Nice ! 8)
User avatar
coco.oric
Squad Leader
Posts: 720
Joined: Tue Aug 11, 2009 9:50 am
Location: North of France
Contact:

Re: 10 Line BASIC Competition 2022!

Post by coco.oric »

Crazy Rax.
These 10 lines are fabulous. You killed the competition
You should be classified "hors competition", with "special price from judges" ;)
coco.oric as DidierV, CEO Member
Historic owner of Oric, Apple II, Atari ST, Amiga
User avatar
ibisum
Wing Commander
Posts: 1652
Joined: Fri Apr 03, 2009 8:56 am
Location: Vienna, Austria
Contact:

Re: 10 Line BASIC Competition 2022!

Post by ibisum »

In case its of interest, I just had to dissect The Snake Temple and try and work out how it was done, so here are my notes - I simply renumbered the BASIC lines so: "x0yy", where x=original line-number, yy=original statement-converted-to-line, and I also added '' comments to point out the sections ..

I have to say, this is really an interesting read. Not only is it fun to realise just how *dense* things are, its also a very simple program, in the end. The trick of encoding the character sprites as text is some serious tonic to this ol' "DATA " type-in nerd.

The fun thing is, the simplicity: the game field buffer is set up, and a tight loop to poll the buffer position is all there is left. The rest is up to the user. Cute thing is, since the field is pseudo-random, if only there were room for one more GOTO, there'd be levels ..

Code: Select all

'' custom character sprites
1000 D$="$$$b$$$b$$$b,bGb#%###3###+7+7Ea?#1>aS1$a#Ab#Vbb##/#AP/5V"
1001 A=#B507
1002 INK6'''
2001 FORI=1TOLEN(D$)
2002 K=ASC(MID$(D$,I,1))-35
2003 POKEA+I,K
2004 NEXT

'' create playing field - draw square walls
2005 DEFFNR(X)=INT(RND(1)*X)
3001 DIMD(999)
3002 O=37
3003 B=161
3004 FORI=0TO36
3005 D(I)=B
3006 D(I+888)=B+1
3007 T=INT(I*.65)*O
3008 D(T)=B''''
4001 D(T+36)=B
4002 NEXT

'' random wall / potion / gremlin setting
4003 PAPER0
4004 H=8
4005 FORY=2TO23STEP2
4006 FORX=2TO34STEP2
4007 D(X+Y*O)=B
4008 R=FNR(5)
5001 D=(R=0)-(R=1)+O*(R=2)-O*(R=3)
5002 D(X+Y*O+D)=B
5003 NEXTX,Y
5004 FORI=0TO924
5005 T=D(I)
5006 ?".";''
6001 IFT=BANDD(I+O)=0THENT=162ELSEIFT=0THENT=FNR(3)+35ELSED(I)=T
6002 NEXT
6003 Y=FNR(22)+2
7001 D(O+1+FNR(35)+FNR(20)*O)=38
7002 X=FNR(35)+2
7003 CLS

'' main game loop
7004 REPEAT
7006 GETK$
7007 Q=X
7008 W=Y
7009 K=ASC(K$)'''
8001 Y=Y+(K=11)-(K=10)
8002 X=X+(K=8)-(K=9)
8003 IFD(X+Y*O)>99THENX=Q
8004 Y=WELSE
8005 B=X+Y*O
8006 Z=D(B)
9001 H=H-2*(Z=36)+(FNR(3)+2)*(Z=O)
9002 FORG=-1TO1
9003 FORL=-1TO1
9004 PLOT2+X+L,Y+G,D(B+L+G*O)'
9005 NEXTL,G
9006 D(B)=35
9007 PLOTX+2,Y,39
9008 ?@2,25;"HP:"H
9009 UNTILZ=38ORH<1
9010 ZAP
9011 IFH>0THEN?"WIN"
User avatar
rax
Flying Officer
Posts: 193
Joined: Tue Jul 24, 2018 3:16 pm

Re: 10 Line BASIC Competition 2022!

Post by rax »

Thank you all :). I expect you to get involved :).
ibisum wrote: Sat Mar 05, 2022 9:58 pm In case its of interest, I just had to dissect The Snake Temple and try and work out how it was done, so here...
Yes, for so few lines and characters you have to think of simple solutions that work. Here is my description of the code:

Code: Select all

0D$="$$$b$$$b$$$b,bGb#%###3###+7+7Ea?#1>aS1$a#Ab#Vbb##/#AP/5V":A=#B507:INK6'''

    D$="$$$b$$$b$$$b,bGb#%###3###+7+7Ea?#1>aS1$a#Ab#Vbb##/#AP/5V" - characters data
    A=#B507 - the start address of characters to be modified
    INK6    - set chars color cyan

----------------------------------------
1FORI=1TOLEN(D$):K=ASC(MID$(D$,I,1))-35:POKEA+I,K:NEXT:DEFFNR(X)=INT(RND(1)*X)

    FORI=1TOLEN(D$)             - change characters 
        K=ASC(MID$(D$,I,1))-35  - gat data from D$
        POKEA+I,K               - change line of character
    NEXT
    DEFFNR(X)=INT(RND(1)*X)     - define custon function R to generate random number

----------------------------------------
2DIMD(999):O=37:B=161:FORI=0TO36:D(I)=B:D(I+888)=B+1:T=INT(I*.65)*O:D(T)=B''''

    DIMD(999)                   - maze array
    O=37                        - maze width
    B=161                       - brick character (33) with set bit 7 for invers colors 
    FORI=0TO36                  - create maze borders
        D(I)=B                  - set top border
        D(I+888)=B+1            - set bottom border
        T=INT(I*.65)*O          - calc left vertical border
        D(T)=B                  - set left border
----------------------------------------
3D(T+36)=B:NEXT:PAPER0:H=8:FORY=2TO23STEP2:FORX=2TO34STEP2:D(X+Y*O)=B:R=FNR(5)

        D(T+36)=B               - set right border
    NEXT
    PAPER0                      - set background color to black
    H=8
    FORY=2TO23STEP2             - generate maze
        FORX=2TO34STEP2
            D(X+Y*O)=B          - set brick
            R=FNR(5)            - get random number bettwen 0-4

----------------------------------------
4D=(R=0)-(R=1)+O*(R=2)-O*(R=3):D(X+Y*O+D)=B:NEXTX,Y:FORI=0TO924:T=D(I):?".";''

            D=(R=0)-(R=1)+O*(R=2)-O*(R=3)   - get direction to set next random brick
            D(X+Y*O+D)=B                    - set random brick
    NEXTX,Y
    FORI=0TO924                             - replaces the standard brick in the maze with another one for a more fancy look :), and set flask and snakes 
        T=D(I)                              - get currnet char in position 
        ?"."                                - print "." into the screen to see some processing is performed

----------------------------------------
5IFT=BANDD(I+O)=0THENT=162ELSEIFT=0THENT=FNR(3)+35ELSE:D(I)=T:NEXT:Y=FNR(22)+2

        IF T=B AND D(I+O)=0 THEN            - if there is a brick in the current position and there is an empty space under it, then
            T=162                           - set new brick in T
        ELSE
            IF T=0 THEN                     - if is only empty block then
                T=FNR(3)+35                 - set in T random char bettwen (35-37) (ground, flask, snake)
            ELSE
                :                           - nothing
        D(I)=T                              - set the modified value in the maze 
    NEXT
    Y=FNR(22)+2                             - get random Y position for player

----------------------------------------
6D(O+1+FNR(35)+FNR(20)*O)=38:X=FNR(35)+2:CLS:REPEAT:GETK$:Q=X:W=Y:K=ASC(K$)'''

    D(O+1+FNR(35)+FNR(20)*O)=38             - set chest into a maze (char 38)
    X=FNR(35)+2                             - get random X position for player
    CLS                                     - clear screen
    REPEAT                                  - game loop
        GET K$                              - get key into k$
        Q=X                                 - old X position
        W=Y                                 - old Y position
        K=ASC(K$)                           - get ascii number for pressed key

----------------------------------------
7Y=Y+(K=11)-(K=10):X=X+(K=8)-(K=9):IFD(X+Y*O)>99THENX=Q:Y=WELSE:B=X+Y*O:Z=D(B)

        Y=Y+(K=11)-(K=10)                   - calc new Y position
        X=X+(K=8)-(K=9)                     - calc new X position
        IFD(X+Y*O)>99 THEN                  - if there is a brick in the new position then
            X=Q                             - return the old position into X
            Y=W                             - return the old position into Y
        ELSE
            :                               - nothing
        B=X+Y*O                             - calc new player position into maze array
        Z=D(B)                              - takes the chars that is in the current player position

----------------------------------------
8H=H-2*(Z=36)+(FNR(4)+1)*(Z=O):FORG=-1TO1:FORL=-1TO1:PLOT2+X+L,Y+G,D(B+L+G*O)'

        H=H-2*(Z=36)+(FNR(4)+1)*(Z=O)           - calc player health whit char in playr position 
                                                ( if it is a flack then add 2 or if a snake then reduced health by 1 to 4  )
        FORG=-1TO1                              - print player area loop 3х3
            FORL=-1TO1
                PLOT2+X+L,Y+G,D(B+L+G*O)        - print current maze char 

----------------------------------------
9NEXTL,G:D(B)=35:PLOTX+2,Y,39:?@2,25;"HP:"H:UNTILZ=38ORH<1:ZAP:IFH>0THEN?"WIN"

        NEXTL,G
        D(B)=35                             - set ground chars into maze (removes snakes and flasks when the player passes them )
        PLOTX+2,Y,39                        - print player
        ?@2,25;"HP:"H                       - print player health on the screen
    UNTIL Z=38 OR H<1                       - do game loop while Z=38 (take chest) or H<1 (the player has no health)
    ZAP                                     - little sound effect
    IF H>0 THEN                             - if the player is healthy then 
        ?"WIN"                              - print "WIN"

User avatar
iss
Wing Commander
Posts: 1642
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: 10 Line BASIC Competition 2022!

Post by iss »

... and the WINNER is "Snake Temple / Oric":



Congrats @rax! and your second entry "Fill the Box /Oric" is #11 - absolutely good too!
User avatar
Symoon
Archivist
Posts: 2310
Joined: Sat Jan 14, 2006 12:44 am
Location: Paris, France

Re: 10 Line BASIC Competition 2022!

Post by Symoon »

Congratulations, I haven't seen the competitors programs but you deserved victory anyway :lol:
User avatar
jbperin
Flight Lieutenant
Posts: 480
Joined: Wed Nov 06, 2019 11:00 am
Location: Valence, France

Re: 10 Line BASIC Competition 2022!

Post by jbperin »

Woaw !!! :shock:

Once again Rax puts the Oric at the top of 8 bits machine as well as he demonstrates his incredible talent !!

Congratulations !! Rax is our hero
User avatar
Dbug
Site Admin
Posts: 4460
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: 10 Line BASIC Competition 2022!

Post by Dbug »

Congratulations for a well deserved victory :)
User avatar
Dom
Flying Officer
Posts: 142
Joined: Sun Nov 25, 2012 7:00 pm

Re: 10 Line BASIC Competition 2022!

Post by Dom »

Congratulations rax for this victory, with the only expert's rate above 8, in the PUR-80 category. :)
User avatar
ibisum
Wing Commander
Posts: 1652
Joined: Fri Apr 03, 2009 8:56 am
Location: Vienna, Austria
Contact:

Re: 10 Line BASIC Competition 2022!

Post by ibisum »

RAX is a GOD of ORIC! NICE!! :)
User avatar
Chema
Game master
Posts: 3019
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: 10 Line BASIC Competition 2022!

Post by Chema »

Congrats!!! Well deserved.

You rock!
User avatar
rax
Flying Officer
Posts: 193
Joined: Tue Jul 24, 2018 3:16 pm

Re: 10 Line BASIC Competition 2022!

Post by rax »

screenshot00.jpg

Code: Select all

10 POKE#26A,10:A=#BB80:REPEAT:READV:POKEA,V:A=A+1:UNTILV=99
20 GOTO20
100 DATA 16,21,21,21,16,21,16,16,16,16,16,16,16,16,16,16,16,21,16,16
110 DATA 19,22,16,21,16,21,16,16,16,16,16,16,16,16,19,19,22,22,19,22
120 DATA 22,16,21,16,16,21,21,16,16,21,21,16,16,21,21,16,16,21,16,21
130 DATA 16,19,16,21,16,21,16,21,21,16,16,21,16,21,16,22,19,22,19,19
140 DATA 19,16,21,16,16,21,16,21,16,21,16,21,16,21,16,21,16,21,21,16
150 DATA 16,22,22,16,21,16,16,21,16,21,16,21,16,21,16,22,22,19,22,19
160 DATA 22,16,21,16,16,21,16,21,16,21,21,21,16,21,16,21,16,21,16,21
170 DATA 16,22,22,16,21,16,16,16,21,21,16,16,21,21,16,22,19,19,19,19
180 DATA 22,22,16,16,16,16,16,16,16,16,16,16,23,23,23,16,16,16,16,16
190 DATA 16,22,19,19,16,16,16,16,16,16,16,16,16,16,16,16,16,16,19,19
200 DATA 22,19,22,19,22,22,22,23,22,22,22,23,16,16,16,23,22,22,22,23
210 DATA 22,19,22,19,22,22,22,19,22,16,21,16,16,21,16,21,16,21,16,22
220 DATA 22,19,22,19,22,22,23,16,23,22,23,16,17,17,17,16,23,22,23,16
230 DATA 23,22,19,19,22,19,19,19,16,21,16,21,16,21,16,21,16,21,16,22
240 DATA 19,22,19,22,22,23,16,17,16,23,16,17,17,17,17,17,16,23,16,19
250 DATA 16,23,22,22,22,19,19,22,16,21,21,21,16,21,16,21,16,16,16,22
260 DATA 22,22,19,19,22,23,16,17,17,16,17,17,17,17,17,17,17,16,17,17
270 DATA 16,23,22,22,22,19,19,22,16,21,16,21,16,21,16,21,16,21,16,19
280 DATA 22,22,22,22,23,16,17,17,17,17,17,17,17,17,17,17,17,17,17,17
290 DATA 19,16,23,22,19,19,22,22,19,16,16,16,16,16,16,16,16,16,19,22
300 DATA 19,19,22,22,23,16,17,17,17,16,16,17,17,17,17,16,16,17,17,17
310 DATA 19,16,23,22,22,19,19,19,22,22,19,22,22,22,22,22,22,19,19,22
320 DATA 19,19,19,22,23,16,17,17,16,17,17,16,17,17,16,17,17,16,17,19
330 DATA 19,16,23,22,22,22,19,22,19,19,22,22,23,23,23,23,22,22,22,22
340 DATA 22,22,19,19,22,23,16,17,17,17,17,17,17,17,17,17,17,17,17,19
350 DATA 16,22,22,22,22,19,19,19,22,22,22,23,23,23,19,23,23,22,22,19
360 DATA 20,20,19,19,22,22,23,16,19,17,17,17,17,17,17,17,19,19,19,16
370 DATA 23,22,19,22,22,22,19,22,22,22,23,23,23,19,19,23,23,23,22,22
380 DATA 20,20,20,20,20,22,22,23,16,16,19,19,19,19,19,19,19,16,16,23
390 DATA 22,22,19,19,22,19,19,22,22,22,23,19,19,19,19,19,19,23,22,19
400 DATA 20,20,20,20,20,20,20,23,23,16,16,16,16,16,16,16,16,23,23,22
410 DATA 19,19,19,19,19,19,19,19,19,22,23,23,19,19,19,19,23,23,22,22
420 DATA 20,20,20,20,20,20,23,16,16,16,16,18,19,19,16,16,16,16,23,20
430 DATA 20,20,20,22,22,19,19,22,19,22,22,23,19,23,23,19,23,22,22,22
440 DATA 20,20,20,20,20,23,16,18,19,16,16,18,18,18,16,18,19,16,16,23
450 DATA 20,20,20,20,22,22,22,19,22,22,22,22,23,23,23,23,22,22,19,19
460 DATA 20,20,20,20,23,16,18,18,18,19,16,18,18,16,18,18,18,19,19,16
470 DATA 23,20,20,20,20,20,19,19,19,22,19,22,22,22,22,22,22,22,22,22
480 DATA 20,20,20,20,23,16,18,18,18,18,16,16,16,16,18,18,18,18,18,16
490 DATA 23,20,20,20,20,20,20,20,20,20,20,19,19,22,22,19,22,19,19,22
500 DATA 20,20,20,23,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16
510 DATA 16,23,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20
520 DATA 20,20,20,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23
530 DATA 23,23,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20
540 DATA 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16
550 DATA 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,20
560 DATA 21,21,16,16,21,21,16,16,21,16,21,21,16,16,21,21,16,21,21,16
570 DATA 16,21,21,16,16,21,21,21,16,21,16,21,16,21,21,21,16,21,21,16
580 DATA 21,16,21,16,21,16,21,16,21,16,21,16,16,16,21,16,16,21,16,21
590 DATA 16,21,16,21,16,21,16,16,16,21,16,21,16,21,16,16,16,21,16,21
600 DATA 21,16,21,16,21,21,16,16,21,16,21,16,16,16,21,21,16,21,16,21
610 DATA 16,21,21,16,16,21,21,16,16,21,16,21,16,21,21,16,16,21,21,16
620 DATA 16,21,21,16,21,16,21,16,21,16,21,21,16,16,21,16,16,16,21,21
630 DATA 16,21,16,21,16,21,21,21,16,16,21,16,16,21,21,21,16,21,16,21
640 DATA 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16
650 DATA 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16
660 DATA 99
RUN
Post Reply