Files
gw-basic-2026/tests/programs/text_adventure.bas
Eremey Valetov 1f4c460f4f Phase 5: CI, terminal I/O, Sixel graphics, classic programs
Add GitHub Actions CI with automated build and test. Implement real
terminal I/O with raw mode (enable_raw/disable_raw, proper INKEY$
polling via VMIN=0/VTIME=0, INPUT$ function). Add Sixel graphics
engine with virtual framebuffer (SCREEN 1: 320x200, SCREEN 2:
640x200), Bresenham line drawing, midpoint circle, flood fill PAINT,
DRAW mini-language parser, and Sixel encoder with RLE. Replace all
graphics stubs with real implementations (PSET, LINE, CIRCLE, DRAW,
PAINT, COLOR, SCREEN, POINT). Fix AND/OR/XOR operator precedence
to be lower than relational operators. Add 13 classic test programs
(39 total). Bump version to 0.5.0.
2026-02-10 16:46:34 -05:00

27 lines
727 B
QBasic

10 REM Mini text adventure (deterministic, no INPUT)
20 REM Uses DATA to simulate player choices
30 DATA 1,2,1,1
40 ROOM% = 1 : TURNS% = 0
50 DIM R$(3)
60 R$(1) = "Dark cave" : R$(2) = "Forest path" : R$(3) = "Treasure room"
70 GOSUB 200
80 IF ROOM% = 3 THEN PRINT "You found the treasure!" : GOTO 150
90 READ CH%
100 TURNS% = TURNS% + 1
110 ON CH% GOSUB 300, 400
120 GOTO 70
150 PRINT "Turns taken:"; TURNS%
160 PRINT "Text adventure OK"
170 END
200 REM Print room
210 PRINT "Room: "; R$(ROOM%)
220 RETURN
300 REM Go north
310 IF ROOM% = 1 THEN ROOM% = 2 : RETURN
320 IF ROOM% = 2 THEN ROOM% = 3 : RETURN
330 RETURN
400 REM Go south
410 IF ROOM% = 2 THEN ROOM% = 1 : RETURN
420 IF ROOM% = 3 THEN ROOM% = 2 : RETURN
430 RETURN