> Quite BASIC
>
Welcome to the clubhouse!
User login
Username:
*
Password:
*
Create new account
Request new password
Navigation
Quite BASIC
Blog
Projects
Help
Forums
Tool Name Hangman
Posted
July 16th, 2007
by
WebSmith
in
Games
Your vote:
Current rating:
1
2
3
4
5
Category
Games
Description
A version of the Hangman game for tools.
>> See More projects by WebSmith
Level
>> Open this project at the main Quite BASIC Page
1000 REM Hangman 1010 CLS 2000 REM Initialize 2010 REM Draw the ground 2020 FOR I = 0 TO 50 2030 PLOT I, 3, "white" 2040 NEXT I 2050 REM E is the number of wrong guesses 2060 LET E = 0 2070 REM Get the word in the variable W 2080 GOSUB 9500 2090 REM N is the number of letters 2100 LET N = LEN (W) 2110 REM A holds the correct answer and L the progressing solution 2120 ARRAY A 2130 ARRAY L 2140 FOR I = 1 TO N 2150 LET A[I] = MID(W, I-1, 1) 2160 LET L[I] = "_" 2170 NEXT I 2180 REM C holds the number of letters correct 2190 LET C = 0 2200 REM Q holds the wrong guesses 2210 LET Q = "" 3000 REM === Main game loop === 3010 CLT 3020 PRINT "Quite BASIC Hangman" 3030 FOR I = 1 TO N 3040 PRINT L[I]; 3050 PRINT " "; 3060 NEXT I 3070 PRINT 3075 PRINT Q 3077 IF C = N THEN GOTO 5000 3080 REM Read keyboard input 3090 LET G = UPPERCASE(GETCHAR()) 3100 IF G < "A" OR G > "Z" THEN GOTO 3090 3110 REM Check the guess 3120 LET Z = 0 3130 FOR I = 1 TO N 3140 IF A[I] = G AND L[I] = "_" THEN GOTO 3200 ELSE GOTO 3290 3200 LET L[I] = G 3210 LET Z = 1 3220 LET C = C + 1 3290 NEXT I 3300 IF Z = 1 THEN GOTO 3000 3310 LET Q = Q + G + ", " 3320 GOSUB 8000 3330 IF E <> 10 THEN GOTO 3000 4000 PRINT "Game Over!" 4010 PRINT "The word is: "; 4020 PRINT W 4030 END 5000 PRINT "Congratulations!" 5010 PRINT "You win!" 5020 END 8000 REM === Subroutine for drawing a piece of the picture === 8010 LET E = E + 1 8020 GOTO 8000 + 100*E 8100 REM Draw the pole 8110 FOR I = 4 TO 40 8120 PLOT 35, I, "white" 8130 NEXT I 8140 RETURN 8200 REM Draw the bar 8210 FOR I = 34 TO 20 STEP -1 8220 PLOT I, 40, "white" 8230 NEXT I 8240 RETURN 8300 REM Draw the cross bar 8310 FOR I = 1 TO 4 8320 PLOT 35-I, 35+I, "white" 8330 NEXT I 8340 RETURN 8400 REM Draw the rope 8410 FOR I = 39 TO 32 STEP -1 8420 PLOT 20, I, "white" 8430 NEXT I 8440 RETURN 8500 REM Draw the head 8510 FOR I = 0 TO 2 * PI STEP PI/10 8520 PLOT 20 + 2*SIN(I), 29 + 2*COS(I), "white" 8530 NEXT I 8540 RETURN 8600 REM Draw the body 8610 FOR I = 27 TO 20 STEP -1 8620 PLOT 20, I, "white" 8630 NEXT I 8640 RETURN 8700 REM Draw the left arm 8710 FOR I = 19 TO 16 STEP -1 8720 PLOT I, 25, "white" 8730 NEXT I 8740 RETURN 8800 REM Draw the right arm 8810 FOR I = 21 TO 24 8820 PLOT I, 25, "white" 8830 NEXT I 8840 RETURN 8900 REM Draw the left leg 8910 FOR I = 0 TO 4 8920 PLOT 20-I, 19-I, "white" 8930 NEXT I 8940 RETURN 9000 REM Draw the right leg 9010 FOR I = 0 TO 4 9020 PLOT 20+I, 19-I, "white" 9030 NEXT I 9040 RETURN 9500 REM === Subroutine for selecting a word === 9510 GOTO 9520 + 2 * FLOOR(RAND(25)) 9520 LET W = "SCREWDRIVER" 9521 RETURN 9522 LET W = "HAMMER" 9523 RETURN 9524 LET W = "WRENCH" 9525 RETURN 9526 LET W = "TABLESAW" 9527 RETURN 9528 LET W = "CHISEL" 9529 RETURN 9530 LET W = "JACKHAMMER" 9531 RETURN 9532 LET W = "PLANER" 9533 RETURN 9534 LET W = "DRILL" 9535 RETURN 9536 LET W = "SHOVEL" 9537 RETURN 9538 LET W = "RAKE" 9539 RETURN 9540 LET W = "WHEELBARROW" 9541 RETURN 9542 LET W = "CHAINSAW" 9543 RETURN 9544 LET W = "SQUARE" 9545 RETURN 9546 LET W = "KNIFE" 9547 RETURN 9548 LET W = "MALLET" 9549 RETURN 9550 LET W = "TROWEL" 9551 RETURN 9552 LET W = "BROOM" 9553 RETURN 9554 LET W = "PLIERS" 9555 RETURN 9556 LET W = "VISE" 9557 RETURN 9558 LET W = "CALIPER" 9559 RETURN 9560 LET W = "CLAMP" 9561 RETURN 9562 LET W = "SCISSORS" 9563 RETURN 9564 LET W = "RULER" 9565 RETURN 9566 LET W = "FILE" 9567 RETURN 9568 LET W = "GRINDER" 9569 RETURN 9570 LET W = "CUTTER" 9571 RETURN
Login
or
register
to post comments
Hi
On June 29th, 2008
darylroy
said:
Good info!!
Login
or
register
to post comments
Popular Projects
Trebuchet II
New version with a mini story plus the popups are gone (yay!). And watch out for the dragon! The popup is replaced by pressing +/- to change the angle and pressing 1-9 to set the force.
Pong with Scoring
A version of the Ping Pong game that keeps the score
Snake Skin
A variant of the Snake game but with a snake skin that moves.
Countries Hangman
A version of the Hangman game where the words are all countries
Tool Name Hangman
A version of the Hangman game for tools.
more
Who's online
There are currently
0 users
and
0 guests
online.
Who's new
piggles
pine
RAFAEL ROMERO
almhath
miken
Active forum topics
Members
LANGUAGE LEARNINGS
ERRORS
more
New forum topics
LANGUAGE LEARNINGS
ERRORS
Members
more
Hi
Good info!!