Conversion of the ancient game Hunt the Wumpus to ANS Forth.
Download wumpus.fs or view Forth source for "Hunt the Wumpus"
Here is a short game:
INSTRUCTIONS (Y-N) ? Y WELCOME TO 'HUNT THE WUMPUS' THE WUMPUS LIVES IN A CAVE OF 20 ROOMS. EACH ROOM HAS 3 TUNNELS LEADING TO OTHER ROOMS. (LOOK AT A DODECAHEDRON TO SEE HOW THIS WORKS-IF YOU DON'T KNOW WHAT A DODECAHEDRON IS, ASK SOMEONE) HAZARDS: BOTTOMLESS PITS - TWO ROOMS HAVE BOTTOMLESS PITS IN THEM IF YOU GO THERE, YOU FALL INTO THE PIT (& LOSE!) SUPER BATS - TWO OTHER ROOMS HAVE SUPER BATS. IF YOU GO THERE, A BAT GRABS YOU AND TAKES YOU TO SOME OTHER ROOM AT RANDOM. (WHICH MIGHT BE TROUBLESOME) WUMPUS: THE WUMPUS IS NOT BOTHERED BY THE HAZARDS (HE HAS SUCKER FEET AND IS TOO BIG FOR A BAT TO LIFT). USUALLY HE IS ASLEEP. TWO THINGS WAKE HIM UP: YOUR ENTERING HIS ROOM OR YOUR SHOOTING AN ARROW. IF THE WUMPUS WAKES, HE MOVES (P=.75) ONE ROOM OR STAYS STILL (P=.25). AFTER THAT, IF HE IS WHERE YOU ARE, HE EATS YOU UP (& YOU LOSE!) YOU: EACH TURN YOU MAY MOVE OR SHOOT A CROOKED ARROW MOVING: YOU CAN GO ONE ROOM (THRU ONE TUNNEL) ARROWS: YOU HAVE 5 ARROWS. YOU LOSE WHEN YOU RUN OUT. EACH ARROW CAN GO FROM 1 TO 5 ROOMS. YOU AIM BY TELLING THE COMPUTER THE ROOM#S YOU WANT THE ARROW TO GO TO. IF THE ARROW CAN'T GO THAT WAY (IE NO TUNNEL) IT MOVES AT RAMDOM TO THE NEXT ROOM. IF THE ARROW HITS THE WUMPUS, YOU WIN. IF THE ARROW HITS YOU, YOU LOSE. WARNINGS: WHEN YOU ARE ONE ROOM AWAY FROM WUMPUS OR HAZARD, THE COMPUTER SAYS: WUMPUS- 'I SMELL A WUMPUS' BAT - 'BATS NEARBY' PIT - 'I FEEL A DRAFT' YOU ARE IN ROOM 12 TUNNELS LEAD TO 19 13 11 SHOOT OR MOVE (S-M)? M WHERE TO? 19 I SMELL A WUMPUS! YOU ARE IN ROOM 19 TUNNELS LEAD TO 18 15 12 SHOOT OR MOVE (S-M)? S NO. OF ROOMS(1-5) 1 ROOM #0 ? 18 AHA! YOU GOT THE WUMPUS! HEE HEE HEE - THE WUMPUS'LL GETCHA NEXT TIME!! TSK TSK TSK- WUMPUS GOT YOU! HA HA HA - YOU LOSE! PLAY AGAIN (Y-N) ?