'=========================================================================== ' Subject: SIMPLIFIED HANGMAN GAME Date: 12-23-98 (18:30) ' Author: The ABC Programmer Code: BEC ' Origin: voxel@edmc.net Packet: BASEC.ABC '=========================================================================== ' HANG.BAS for BASEC [DOS/UNIX], by William Yu ' ' An overly simplified version of hangman, without the man :) CONST false = 0 CONST true = NOT false DIM words$(100) AS STRING DIM word AS STRING DIM L$ AS STRING * 1 DIM done AS INTEGER DATA 12 DATA horse, computer, accessories, townhouse, terminal, directory DATA library, desktop, zebra, degenerate, calculus, pumpkin READ num FOR i = 1 TO num READ words$(i) NEXT i PRINT : PRINT "HANG DUD by William Yu" RANDOMIZE TIMER playagain: n = rnd(num)+1 word = STRING$(LEN(words$(n)), "-") L$ = "" GOSUB Displayword DO PRINT "Guess a letter [0 = Quit]: "; : L$ = UCASE$(GET$(1)) GOSUB Displayword IF done = true THEN PRINT "Wow, you got it! Congratulations, play again [y/n]? "; L$ = UCASE$(GET$(1)) IF L$ = "Y" THEN GOTO playagain L$ = "0" END IF LOOP UNTIL L$ = "0" END Displayword: PRINT : PRINT "The mystery word: "; FOR i = 1 TO LEN(words$(n)) IF L$ = MID$(UCASE$(words$(n)), i, 1) THEN word = LEFT$(word, i - 1) + L$ + MID$(word, i + 1, 255) END IF NEXT i PRINT word done = true FOR i = 1 TO LEN(word) IF MID$(word, i, 1) = "-" THEN done = false NEXT i RETURN