Jump to content
IGNORED

Tentris, a Tetris in 10 lines of GW-BASIC


Recommended Posts

Hi all.

 

I got pointed to the 10Liner BASIC Game Jam https://itch.io/jam/ascii-basic-10liner

 

And I wondered if a Tetris-like game would be possible, it happens it is!!! But it was amazingly difficult to fit it into 10 lines and 72 characters each line!!!

 

https://nanochess.itch.io/tentris

 

Use your original IBM PC, or DosBox with GW-BASIC. Press A to go left, D to go right, W to rotate.

 

Enjoy it!

 

P.S: The source code

 

0 P$="BJ@@QJI@JB@@IJQ@IIII@D@@JJ@@JJ@@QQJ@AC@@JII@CQ@@IIJ@CA@@JQQ@QC@@"
1 CLS:B$=CHR$(219):FOR Y=1 TO 19:PRINT,B$,B$:NEXT:PRINT,STRING$(15,B$)
2 X=19:C=X:R=C:WHILE R:D=13:FOR E=16 TO 28:D=D+(SCREEN(R,E)=219):NEXT
3 IF D THEN FOR E=16 TO 28:LOCATE C,E:PRINT CHR$(SCREEN(R,E)):NEXT:C=C-1
4 R=R-1:WEND:Y=0:Z=INT(RND*6)*8:Z=Z-(Z>39)*8:I=8-(Z>31)*8:WHILE 1:C$=""
5 H=0:GOSUB 8:C$=B$:IF H THEN R=Q:X=U:IF A$=""THEN Y=Y-1:GOSUB 8:GOTO 2
6 GOSUB 8:Q=R:U=X:A$=INKEY$:IF""=A$THEN IF TIMER<S THEN 6ELSE S=TIMER+.5
7 C$=" ":GOSUB 8:X=X+(A$="A")-(A$="D"):Y=Y-(A$=""):R=R-(A$="W")*4:WEND
8 FOR C=1 TO 4:D=ASC(MID$(P$,Z+R MOD I+C))-64:W=D\8:WHILE D:D=D-1 AND 7
9 H=H+(SCREEN(Y+C,X+W+D)>32):LOCATE Y+C,X+W+D:PRINT C$:WEND:NEXT:RETURN

 

tentris.png

tentris.zip

Edited by nanochess
  • Like 8
  • Thanks 1
Link to comment
Share on other sites

Is the limitation at 72 keystrokes per line (because abbreviations are accepted and keywords would get expanded beyond line length) to distinguish from the other BASIC10Liners compo that starts at 80 keystrokes per line? I like the idea but get confused at multiple, very similar formats. This one also doesn't allow UDG but clearly systems with hires drawing capacities may use those instead.

  • Like 1
Link to comment
Share on other sites

13 hours ago, nanochess said:

Hi all.

 

I got pointed to the 10Liner BASIC Game Jam https://itch.io/jam/ascii-basic-10liner

 

And I wondered if a Tetris-like game would be possible, it happens it is!!! But it was amazingly difficult to fit it into 10 lines and 72 characters each line!!!

 

https://nanochess.itch.io/tentris

 

Use your original IBM PC, or DosBox with GW-BASIC. Press A to go left, D to go right, W to rotate.

 

Enjoy it!

 

P.S: The source code

 


0 P$="BJ@@QJI@JB@@IJQ@IIII@D@@JJ@@JJ@@QQJ@AC@@JII@CQ@@IIJ@CA@@JQQ@QC@@"
1 CLS:B$=CHR$(219):FOR Y=1 TO 19:PRINT,B$,B$:NEXT:PRINT,STRING$(15,B$)
2 X=19:C=X:R=C:WHILE R:D=13:FOR E=16 TO 28:D=D+(SCREEN(R,E)=219):NEXT
3 IF D THEN FOR E=16 TO 28:LOCATE C,E:PRINT CHR$(SCREEN(R,E)):NEXT:C=C-1
4 R=R-1:WEND:Y=0:Z=INT(RND*6)*8:Z=Z-(Z>39)*8:I=8-(Z>31)*8:WHILE 1:C$=""
5 H=0:GOSUB 8:C$=B$:IF H THEN R=Q:X=U:IF A$=""THEN Y=Y-1:GOSUB 8:GOTO 2
6 GOSUB 8:Q=R:U=X:A$=INKEY$:IF""=A$THEN IF TIMER<S THEN 6ELSE S=TIMER+.5
7 C$=" ":GOSUB 8:X=X+(A$="A")-(A$="D"):Y=Y-(A$=""):R=R-(A$="W")*4:WEND
8 FOR C=1 TO 4:D=ASC(MID$(P$,Z+R MOD I+C))-64:W=D\8:WHILE D:D=D-1 AND 7
9 H=H+(SCREEN(Y+C,X+W+D)>32):LOCATE Y+C,X+W+D:PRINT C$:WEND:NEXT:RETURN

 

tentris.png

tentris.zip 3.17 kB · 2 downloads

Cool BASIC 10 liner! :) Microsoft GW BASIC looks very similar to Microsoft Extended Color BASIC, might run on both platforms.

  

  • Like 1
Link to comment
Share on other sites

Neat!  I am feeling compelled to convert this to TI Extended BASIC.  I have all of the statements done, including conversion of the missing WHILE/WEND, and just need to work out the ASCII and screen size differences. (oh, and the missing TIMER equivalent.)

  • Like 2
Link to comment
Share on other sites

7 hours ago, carlsson said:

Is the limitation at 72 keystrokes per line (because abbreviations are accepted and keywords would get expanded beyond line length) to distinguish from the other BASIC10Liners compo that starts at 80 keystrokes per line? I like the idea but get confused at multiple, very similar formats. This one also doesn't allow UDG but clearly systems with hires drawing capacities may use those instead.

Apparently no High-res graphics per my interpretation of the rules: Bloxels are allowed as long as they come from the rom character set, but someone drawed an animated checkered floor in a game.

4 hours ago, Mr SQL said:

Cool BASIC 10 liner! :) Microsoft GW BASIC looks very similar to Microsoft Extended Color BASIC, might run on both platforms.

  

It would be cool. Tried MSX-BASIC and misses the SCREEN() operator for reading screen.

 

3 minutes ago, OLD CS1 said:

Neat!  I am feeling compelled to convert this to TI Extended BASIC.  I have all of the statements done, including conversion of the missing WHILE/WEND, and just need to work out the ASCII and screen size differences. (oh, and the missing TIMER equivalent.)

It would be interesting to see.

Link to comment
Share on other sites

On 6/24/2021 at 12:04 PM, nanochess said:

It would be interesting to see.

It has required shifting a few things around due to XB limitations, the most annoying of which is that FOR cannot exist in an IF-THEN statement.  You developed a really neat way to draw the shapes.  I am not confident I could meet a line length limit, but XB does impose its own length limitation based upon tokenization.  In any case, the SO has dragged me out today to meet up with her parents so I will not be doing anything until tomorrow night.

  • Like 3
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...