That’s the ‘what it looks like in the App Store’ image. This allows you to do a bit of BASIC programming.
10 REM HANGMAN
30 CLS
50 PRINT"HANGMAN by Jeff Wright"
70 PRINT
90 GOSUB 1300:REM CALCULATE NUMBER OF WORDS
110 INPUT "What is your name";NAME$
130 IF NAME$="" THEN LET NAME$="Anonymous"
150 IF LEFT$(NAME$,1)=>"a" AND LEFT$(NAME$,1)=<"z" THEN GOSUB 1000
170 CLS:PRINT"HANGMAN by Jeff Wright":PRINT
190 PRINT"Hello ";NAME$;"!"
250 RESTORE
270 DIM W$(N)
290 FOR L=1 TO N
310 READ W$(L)
330 GOSUB 1200:REM CAPITALISE WORDS
370 NEXT L
390 LET G=INT(RND(1)*N)+1
400 PRINT
410 PRINT"Let Us Play HANGMAN"
420 PRINT"You have 10 Lives"
425 PRINT
430 PRINT "Guess the word, it has ";LEN(W$(G));" letters"
450 LET SOFAR$=""
470 Q=LEN(W$(G)):PRINT"So far guessed: ";
490 FOR F=1 TO Q
510 LET SOFAR$=SOFAR$+"-"
530 NEXT F
550 PRINTSOFAR$
560 LET LIVES=10
570 PRINT
590 PRINT"Make a guess: >";
610 GET K$:GOSUB 1500:REM CAPITALISE GUESS
630 IF K$="" THEN GOTO 610
650 PRINTK$
660 LET FOUND=0
665 LET SF$=SOFAR$:LET SOFAR$=""
670 FOR F=1 TO LEN(W$(G))
690 IF K$=MID$(W$(G),F,1) THEN LET FOUND=1
710 IF K$=MID$(W$(G),F,1) THEN LET SOFAR$=SOFAR$+K$
723 IF K$<>MID$(W$(G),F,1) THEN LET SOFAR$=SOFAR$+MID$(SF$,F,1)
730 NEXT F
750 IF FOUND=1 THEN PRINT "Well done ";NAME$;", you have guessed a correct letter!"
755 IF FOUND=1 THEN GOSUB 1600
760 IF FOUND=0 THEN PRINT "Sorry ";NAME$;", incorrect letter, you have lost a life!"
765 IF FOUND=0 THEN LET LIVES=LIVES-1:GOSUB 1630
770 PRINT"You have";LIVES;"lives remaining"
773 PRINT"So far guessed: ";SOFAR$
780 IF LIVES=0 THEN PRINT:PRINT"Sorry ";NAME$;" you have lost all your lives"
790 IF LIVES=0 THEN PRINT"The correct word was: ";W$(G)
800 IF W$(G)=SOFAR$ THEN PRINT:PRINT"Congratulations ";NAMES$;" word correctly guessed!"
850 IF W$(G)<>SOFAR$ AND LIVES>0 THEN GOTO 570
860 PRINT:PRINT"Would you like to play again (Y/N)?";
870 GET K$:GOSUB 1500:REM CAPITALISE GUESS
880 IF K$="" THEN GOTO 870
890 IF K$="Y" THEN GOSUB 1800
892 IF K$="Y" THEN GOTO 390
900 CLS:PRINT"Thank you for playing HANGMAN by Jeff Wright"
910 PRINT"Goodbye"
920 END
1000 REM SORT NAME
1020 LET K=ASC(LEFT$(NAME$,1))
1030 LET NAME$=CHR$(K-32) + RIGHT$(NAME$,LEN(NAME$)-1)
1040 RETURN
1200 REM CAPITALISE WORDS
1210 FOR M=1 TO LEN(W$(L))
1213 LET T$=""
1215 LET K=ASC(MID$(W$(L),M,1))
1220 IF K>96 AND K<123 THEN LET T$ = LEFT$(W$(L),M-1)
1230 IF K>96 AND K<123 THEN LET T$=T$+CHR$(K-32)
1240 IF K>96 AND K<123 THEN LET T$=T$+RIGHT$(W$(L),LEN(W$(L))-M)
1250 IF K>96 AND K<123 THEN LET W$(L)=T$
1260 NEXT M
1270 RETURN
1300 REM CALCULATE NUMBER OF WORDS
1310 LET N=0
1320 READ T$
1330 IF T$<>"end" THEN LET N=N+1
1340 IF T$<>"end" THEN GO TO 1320
1350 RETURN
1500 REM CAPITALISE GUESS
1505 IF K$="" THEN RETURN
1510 LET K=ASC(K$)
1520 IF K>96 AND K<123 THEN LET K$=CHR$(K-32)
1530 IF K$<"A" OR K$>"Z" THEN LET K$=""
1540 RETURN
1600 REM CORRECT SOUND
1610 ALERT 1
1620 RETURN
1630 REM WRONG SOUND
1640 ALERT 5
1650 RETURN
1800 REM RESTART
1810 CLS
1820 PRINT"HANGMAN by Jeff Wright"
1830 RETURN
2000 DATA "Responsibility","Originate","Supernova","Treadmill","Wasteland"
2010 DATA "Locomotive","Fundamental","Dragonfly","Nincompoop","Outrageous"
2020 DATA "Posture","Publication","Rocketry","Monetary","Sandpaper"
2030 DATA "respiratory","scaffolding","seasonal","solution","consequence"
2040 DATA "uncharacteristic","upholsterer","voluntary","wavelength","worrisome"
2050 DATA "zigzag","aversion","backstroke","cabbage","dictaphone"
2060 DATA "esplanade","flapjack","garrison","historical","impassioned"
2070 DATA "juggernaut","kindergarten","lowland","mechanism","newfangled"
2080 DATA "orphanage","packaging","quotient","reception","seasonable"
2090 DATA "townspeople","unification","venturesome","windscreen","xylophone"
2100 DATA "youthful","zodiac"
5000 DATA "end"
5010 REM Hangman
No comments:
Post a Comment