Page 1 of 1

Hang_Anne

Posted: Tue Feb 20, 2007 2:16 am
by Rebel
T'was bored, so here's a jp/tres related hangman game. Text-
based, source files included....

http://www.geocities.com/lastrebel41/Hang_Anne.zip

Posted: Tue Feb 20, 2007 3:02 am
by machf
Hmmm... I still have my two-player BASIC Hangman lying around on my HDD:

Code: Select all

10 PLAY "mb": INPUT P$: P$ = LCASE$(P$)
20 L = LEN(P$): X$ = ""
25 FOR N = 1 TO L: X$ = X$ + "-": NEXT
27 CLS : LOCATE 10, 20: PRINT X$: L$ = STRING$(26, " "): X = 0
30 a$ = INKEY$: a$ = LCASE$(a$)
40 IF a$ < "a" OR a$ > "z" THEN 30
45 LOCATE 20, 10: PRINT SPC(25);
50 C = ASC(a$) - 96: IF INSTR(L$, a$) THEN LOCATE 20, 10: PRINT "Esa letra ya la usaste...": GOTO 30
55 MID$(L$, C, 1) = a$: LOCATE 5, 32: PRINT L$: a = 1
60 K = INSTR(a, P$, a$): IF a = 1 AND K = 0 THEN X = X + 1: ON X GOSUB 200, 210, 220, 230, 240, 250, 260, 270, 280, 290: LOCATE 7, 64: PRINT X; "fallas": IF X = 10 THEN GOTO 100 ELSE GOTO 30
70 IF K THEN MID$(X$, K, 1) = a$: IF K < L THEN a = K + 1: GOTO 60
75 LOCATE 10, 20: PRINT X$: IF X$ = P$ THEN PLAY "o3c2g2fed>c2<g4.p8fed>c2<g4.p8fefd": LOCATE 20, 10: PRINT "­Felicidades, desgraciado! ­Adivinaste!": END
80 GOTO 30
100 PLAY "o1c4.p8c4.p16ccp16d4c+c+cc<b>c": LOCATE 20, 20: PRINT "­Est s muerto!"
110 LOCATE 21, 20: PRINT "La palabra era: "; P$: END
200 LOCATE 13, 5: PRINT "ÉÍÍ": FOR V = 14 TO 17: LOCATE V, 5: PRINT "º": NEXT: LOCATE 18, 5: PRINT "Ð": RETURN
210 LOCATE 13, 8: PRINT "Ñ": RETURN
220 LOCATE 14, 8: PRINT CHR$(2): RETURN
230 LOCATE 15, 8: PRINT "Ã…": RETURN
240 LOCATE 15, 7: PRINT "Ú": RETURN
250 LOCATE 15, 9: PRINT "¿": RETURN
260 LOCATE 16, 8: PRINT "Á": RETURN
270 LOCATE 16, 7: PRINT "Ú": LOCATE 17, 7: PRINT "Ù": RETURN
280 LOCATE 16, 9: PRINT "¿": LOCATE 17, 9: PRINT "À": RETURN
290 LOCATE 14, 8: PRINT CHR$(1): RETURN


Posted: Tue Feb 20, 2007 3:13 am
by Rebel
If I used goto in c++ code, I'd be hung! :o

Is that the entire program?

Posted: Tue Feb 20, 2007 3:38 am
by machf
Yep, it's short and simple.

Well, those GOTO 30 statements are simply the main loop; the GOTO 60 is checking for more than one ccurrence of a single letter within the word, and the GOTO 100 is the "you lose" case...

Posted: Tue Feb 20, 2007 3:48 am
by Rebel
Basic reminds me of Dos. It's been so long since I've screwed with
it, but there's a definite structural similarity there.

Posted: Tue Feb 20, 2007 3:56 am
by machf
This isn't even QuickBASIC, it's GW-BASIC... wow, this program is really old! I remember writing it in AtariBASIC on my 800XL first, later porting it to the PC.

Posted: Tue Feb 20, 2007 4:15 am
by Rebel
Going way back, early eighties, I wrote a few copycat games based
on early arcades. Tank battle, asteriods - they were pretty horrible
copies though. That was all Dos stuff, I didn't even use Windows3.
1 back then even though I think it was available.

Posted: Tue Feb 20, 2007 4:43 am
by Christopher
Nice little game Rebel :)

But I ran into a bit of a bug...

[Spoilers for those who don't want one of the answers revealed]

The game didn't seem to recognise one letter being in several locations. For the answer "John Hammond" I had to enter 'h' twice, 'o' twice, 'n' twice and 'm' twice. I don't know if you intended this or not.

Still a fun little program :)

Posted: Tue Feb 20, 2007 4:47 am
by Rebel
The game didn't seem to recognise one letter being in several locations. For the answer "John Hammond" I had to enter 'h' twice, 'o' twice, 'n' twice and 'm' twice. I don't know if you intended this or not.
Yea, that's the way I coded it, Chris. If it revealed all the letters, it'd be too much like wheel of fortune (or whatever that game is called). 1 guess, 1 letter. ;)

.... and thanks. It's not much, just a little something to goof around with.