sdb:wumpus_game
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| sdb:wumpus_game [2026/02/19 11:53] – appledog | sdb:wumpus_game [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | = WUMPUS GAME | ||
| - | == About | ||
| - | * Wumpus draws from 1973 Hunt the Wumpus, with growling clues in grid caves. | ||
| - | * Originally written by Neo on a C128 simulator when he was 11, as homework for his programming class. | ||
| - | * Ported to Stellar BASIC 1.0 in 2026. | ||
| - | |||
| - | The history traces back to Gregory Yob, a University of Massachusetts student, who coded the original in FORTRAN IV in spring 1973 on a PDP-10 mainframe. Frustrated by flat-grid " | ||
| - | |||
| - | == Developer' | ||
| - | === Neo says | ||
| - | I wrote this program in about 30 minutes. Its a random small light game. | ||
| - | |||
| - | The WUMPUS and the exit door was supposed to start at the walls but I just made it spawn anywhere in the room (to keep the program smaller). It feels weird having a random exit door anywhere, but it's simpler this way. | ||
| - | |||
| - | === Appledog says | ||
| - | I made some QOL changes such as making sure the wumpus and the exit don't spawn on top of the player. Mostly I tried not to modify Neo's code too much but there were a few issues because he didn't have access to the system when he wrote the code (!!). For example he didn't know there was no support for negative numbers. | ||
| - | |||
| - | Of special note are lines 310 and 330: | ||
| - | |||
| - | 310 IF E > 100 THEN GOTO 5000 : REM CAUGHT WRAP-AROUND FROM MOVING WEST OF 0 | ||
| - | | ||
| - | 330 IF F > 100 THEN GOTO 5200 : REM CAUGHT WRAP-AROUND FROM MOVING SOUTH OF 0 | ||
| - | |||
| - | The issue here is that Stellar BASIC 1.0 is a TinyBASIC, and therefore it does not support negative numbers. The test here is if it rolls over into negative numbers, it will appear as 65535 or such. | ||
| - | |||
| - | Also, the lines such as: | ||
| - | |||
| - | 6030 IF I > 100 THEN LET I = A - E | ||
| - | 6040 IF J > 100 THEN LET J = B - F | ||
| - | |||
| - | are part of an absolute value comparison. You may ask why 100 was chosen as the number to test for the rollover. We could have used 16, 20 or 1000-- any number greater than the biggest possible number on the grid, 15 (i.e. 15-0). | ||
| - | |||
| - | The original code did not have rollover detection, and I asked Neo if this was intentional. He said no. So I quickly drafted the code at 5000-5500 to do rollover detection. I also came up with the RAND to move the WUMPUS since Neo's code relied on a differential (which relied on negative numbers). So I did it to (ex. E < A) to compare the position that way. A minor but useful change. | ||
| - | |||
| - | == Program Listing | ||
| - | <codify BASIC> | ||
| - | 10 PRINT "" | ||
| - | 20 PRINT " | ||
| - | 30 PRINT "BY NEO (C) 2019" | ||
| - | 40 PRINT "" | ||
| - | 50 PRINT "THERE IS A WUMPUS IN THE ROOM." | ||
| - | 60 PRINT "FIND THE ESCAPE DOOR OR DIE." | ||
| - | 70 PRINT "WHEN THE WUMPUS MOVES, YOU WILL KNOW." | ||
| - | 80 PRINT "0 IS NORTH, 1 IS EAST, 2 IS SOUTH, 3 IS WEST." | ||
| - | 90 PRINT "GOOD LUCK" | ||
| - | 100 LET A = RAND(16) | ||
| - | 110 IF A = 8 GOTO 100 | ||
| - | 120 LET B = RAND(16) | ||
| - | 130 IF B = 8 GOTO 120 | ||
| - | 140 LET C = RAND(16) | ||
| - | 150 LET D = RAND(16) | ||
| - | 160 LET E = 8 | ||
| - | 170 LET F = 8 | ||
| - | 180 LET G = 0 | ||
| - | |||
| - | 200 PRINT "" | ||
| - | 210 PRINT "YOU ARE AT: "E,F | ||
| - | 215 GOTO 6000 | ||
| - | 220 INPUT "MOVE WHERE? ", G | ||
| - | 230 IF G = 0 THEN LET F = F + 1 | ||
| - | 240 IF G = 0 THEN PRINT "YOU MOVE NORTH." | ||
| - | 250 IF G = 1 THEN LET E = E + 1 | ||
| - | 260 IF G = 1 THEN PRINT "YOU MOVE EAST." | ||
| - | 270 IF G = 2 THEN LET F = F - 1 | ||
| - | 280 IF G = 2 THEN PRINT "YOU MOVE SOUTH." | ||
| - | 290 IF G = 3 THEN LET E = E - 1 | ||
| - | 300 IF G = 3 THEN PRINT "YOU MOVE WEST." | ||
| - | |||
| - | 310 IF E > 100 THEN GOTO 5000 | ||
| - | 320 IF E > 15 THEN GOTO 5100 | ||
| - | 330 IF F > 100 THEN GOTO 5200 | ||
| - | 340 IF F > 15 THEN GOTO 5300 | ||
| - | |||
| - | 350 IF E = A THEN GOTO 1000 | ||
| - | 360 IF E = C THEN GOTO 2000 | ||
| - | |||
| - | 370 LET W = RAND(3) | ||
| - | 380 IF W = 1 THEN GOTO 500 | ||
| - | 390 GOTO 200 | ||
| - | |||
| - | 500 LET Z = RAND(10) | ||
| - | 510 IF Z > 4 THEN GOTO 550 | ||
| - | |||
| - | 520 IF A < E THEN LET A = A + 1 | ||
| - | 530 IF A > E THEN LET A = A - 1 | ||
| - | 540 GOTO 570 | ||
| - | |||
| - | 550 IF B < F THEN LET B = B + 1 | ||
| - | 560 IF B > F THEN LET B = B - 1 | ||
| - | |||
| - | 570 PRINT "THE WUMPUS MOVES CLOSER..." | ||
| - | 580 IF E = A THEN GOTO 1000 | ||
| - | 590 GOTO 200 | ||
| - | |||
| - | 1000 IF F = B THEN GOTO 3000 | ||
| - | 1010 GOTO 200 | ||
| - | |||
| - | 2000 IF F = D THEN GOTO 4000 | ||
| - | 2010 GOTO 200 | ||
| - | |||
| - | 3000 PRINT "OH NO! THE WUMPUS ATE YOU!!!" | ||
| - | 3010 GOTO 4010 | ||
| - | |||
| - | 4000 PRINT " | ||
| - | 4010 PRINT "GAME END" | ||
| - | 4020 GOTO 9001 | ||
| - | |||
| - | 5000 PRINT "THERE IS A WALL TO THE WEST." | ||
| - | 5010 LET E = 0 | ||
| - | 5020 GOTO 350 | ||
| - | |||
| - | 5100 PRINT "THERE IS A WALL TO THE EAST." | ||
| - | 5110 LET E = 15 | ||
| - | 5120 GOTO 350 | ||
| - | |||
| - | 5200 PRINT "THERE IS A WALL TO THE SOUTH." | ||
| - | 5210 LET F = 0 | ||
| - | 5220 GOTO 350 | ||
| - | |||
| - | 5300 PRINT "THERE IS A WALL TO THE NORTH." | ||
| - | 5310 LET F = 15 | ||
| - | 5320 GOTO 350 | ||
| - | |||
| - | 6000 REM WUMPUS WARNING -- MOD BY APPLEDOG | ||
| - | 6010 LET I = E - A | ||
| - | 6020 LET J = F - B | ||
| - | 6030 IF I > 100 THEN LET I = A - E | ||
| - | 6040 IF J > 100 THEN LET J = B - F | ||
| - | 6050 IF I = 0 THEN PRINT "YOU HEAR A STRANGE GROWLING!" | ||
| - | 6060 IF J = 0 THEN PRINT "YOU HEAR A STRANGE GROWLING!" | ||
| - | 6070 GOTO 220 | ||
| - | |||
| - | 9001 REM END | ||
| - | </ | ||
| - | |||
| - | == Bugs | ||
| - | There is a quite rare //(but also quite shiny!)// bug in the code! Oh no! If you can find the bug, let us know and you will have your name added to the WUMPUS GAME HALL OF FAME below: | ||
| - | |||
| - | === WUMPUS GAME HALL OF FAME | ||
| - | * Appledog | ||
| - | * Neo | ||
sdb/wumpus_game.1771502014.txt.gz · Last modified: by appledog
