Written By TheVBProgramer.
PROGRAMMING EXERCISE tutorial
Hangman
Write a VB program that implements the classic game of Hangman.
· The program will require three data files:
(1) The main file, called HMPuzz.dat, which contains the puzzles that the user must solve. This is a comma-delimited file containing two fields:
(a) The puzzle, which is a string containing up to 20 characters. The puzzles will contain only letters and blank spaces (no special characters such as hyphens, commas, or quotes).
(b) A "clue code", which is an integer between 1 and 5 representing a clue that can be displayed to the user on the gameboard.
A sample set of records is shown below:
"BORN TO BE WILD",4
"MARY TYLER MOORE",1
"WEST VIRGINIA",2
"LOVE CONNECTION",4
"MAD ABOUT YOU",4
"THOMAS JEFFERSON",1
"PAPUA NEW GUINEA",2
(2) A "lookup table", called HMClues.dat, which contains two fields: (a) the "clue code" (an integer between 1 and 5) and (b) the clue description. This file contains the following data:
1,"PERSON OR GROUP"
2,"PLACE"
3,"THING"
4,"TITLE"
5,"FICTIONAL CHARACTER"
(3) A file called LastPuzz.dat, which simply contains one record with one field: a number indicating the last puzzle that was played, which will serve as a starting point for a new run of the program. This enables you to vary which puzzles are used from session to session.
At program startup, load the data from the first two files into arrays and store the "last puzzle" number into a variable. When the program first begins, and whenever the user clicks the "New Game" button, increment the "last puzzle" value and select the puzzle from the array of puzzles loaded from the first file using the "last puzzle" value as an index into the array.
· Visually present the "covered up" puzzle to the user, along with the hangman's gallows (which can be simply drawn with line controls), and a pool of the 26 letters of the alphabet (these can be labels or command buttons). Also display a clue description associated with the puzzle.
· When the user clicks a letter, if any occurrences of that letter are present in the puzzle, reveal them all to the user; if that letter is not present in the puzzle, then draw another body part on the "hanged man". In any event, disable the chosen letter.
· The hanged man has six body parts: a head, a torso, two arms and two legs. All parts can be created with the line control, except the head, which can be created with the circle option of the shape control. If the hanged man is drawn before all the letters of the puzzle are revealed, the player loses; if the all the letters of the puzzle are revealed before the hanged man is drawn, the player wins.
· Provide a "solve the puzzle" option, which enables the player to guess the answer early in the game. If the player guesses correct, the player wins; otherwise, the player loses.
· The program should provide options to play a new game and to quit.
Following are some screen shots of my version of this program, to give you some ideas. Feel free to vary the design any way you want, as long as the project requirements are met.
Splash Screen

When game first begins

While game is in progress

When player wins

When player loses

The "Solve Puzzle" Option …

Note: If you implement the "Solve Puzzle" option with an InputBox as I did, make sure you parse the user's response so that an entry that contains lowercase letters and/or extra spaces will not count against the user when you compare the user's response to the answer.
Download the solution for this project here.
Comments
Beggers
Wat the beggers? the code writer of this hangman is a great fraud...
Need code to do hangman game
I need help. I have gone back to school and making a hangman game is one of my assignments and I am really struggling. Can someone send me the code to do this. I need help.
Nice a game....
Nice a game....
NEEDS THE CODE
i need the code please sent me a copy of it...for studies purposes....
can you send me the code please?
I'm a computer science student and I'm learning game programming, can you please send me the code and the project please?
can you send me the code for
can you send me the code for this game. Thank you very much!!
please help
Can anybody help me with Hangman game full code.
My email: serbangeorge@yahoo.com
Hey. Can you please send me
Hey.
Can you please send me the VB6 code for this game ?
I need it soon.
Thanks a lot.
U GO TO HELL AND YOU WILL
U GO TO HELL AND YOU WILL GET THE CODES
hangman code
plz send me the complete code of hangman project in visual basic 6.
CAN U PLEASE SEND ME THE
CAN U PLEASE SEND ME THE CODES OF THIS VISUAL BASIC GAMES.....
AS SOON AS AUGUST 2009 MY EMAIL IS swastikaconan@yahoo.com
NEED THE CODE - MANY THANKS
hello, i appreciate the article very much.
do u think u can send me the code please?
many thanks in advance! =)
you can't have it
you can't have it
Help? Please
Hey look i cant get this part of the code working:
intFileNbr = FreeFile
Open (App.Path & "\HMPuzz.dat") For Input As #intFileNbr
Do Until EOF(intFileNbr)
mintNbrOfPuzzles = mintNbrOfPuzzles + 1
ReDim Preserve maudtPuzzleRec(1 To mintNbrOfPuzzles)
With maudtPuzzleRec(mintNbrOfPuzzles)
Input #intFileNbr, .Puzzle, .Clue
End With
Loop
Close #intFileNbr
Can you help me? it gets an error saying file not found where do i put it?
hagman
i am new to this and am in my last year of college and i really need help to create this game all i really need help doing is the code please help
CODE OF HANGMAN
i try to make a hangman and i do it... im juz continuing my project because im needed to add more question for so hard to post the code here because it has a many code... if you trying this game to build and if you have a question email me at astro_psyco4@yahoo.com tnx...
HELPPP!!
Could Someone send me the code to this
ASAP..REALLY NEEDED
HERES MY EMAIL
m.aboutme@yahoo.com
THANKS
code!!!!!!
i want to get this working. so please help me with the code pleeeaase!!
please ...
hi .. can u please send the code for hangman? i am beggin u. i am the group leader, an innocent group leader. don't know some parts of VB. and please. my groupmates are all looking forward for me to have our final input. but the truth is i still dont have anything. i am dying to have this code.. so pleasee. I AM BEGGING YOU. T.T I REALLY NEED THIS CODE, ASAP ..
THANKSS(:
I offer help
I can help...
ofcourse i need to be paid...
no worries it wouldnt cost much...
contact me via my email jcwebhole@yahoo.com
lol
I think its funny that you all seem to have school projects and that you are all to lazy to do it yourself. Im a senior in high school and ive been given projects to complete that are way harder than this and i never went around begging people to just send me the code. I do what I must and that is why as soon as I graduate i will be able to get a good job and know what im doing because i didn't have to beg sombody else to help with something that I should have done myself
i understand your point but still...
im in the same boat as you, but for some of us, that are going ABOVE AND BEYOND the reqired level of advancedment in the program, we still need help in some aspects of the code, like for me, im stuck at this point as im using vb6, not vb.net, just vb, and im clueless as to how to integrate the letters and the var for the actual word into the program, as they are very complex, but these noobs are just being lazy, so you have a point as well...lol...
Can u please send me.
PLEASE send me the complete codes in my email
paulinebestf_367@yahoo.com
i need it badly please send it ASAP
THANKS :D
hi
can you email me the complete code of this? i really need it
bloodwitch08@yahoo.com
thanks!
plz email me the full code
plz email me the full code for this asap at randall6611@hotmail.com
I need your help
Could you please email me the full code for this game?
I request you to please send me the code for this game asap...
THIS IS MY E-mail add
ElizabethC.Parrish@live.com.ph
pls helllppp
we have a proj.and we have to make a game.i'm not good at coding.so can anyone help me? PLEASE. the game is like hangman.but the character is a flower,when you press the wrong letter 1 petal will disappear.when you finish 1 level, the flower will grow. so can anyone HEELLLPP??
thanksss.if u can help me,pls post ur e-mail.
heplme
dasgood day can u please help me to my thesis
my my thesis is to create a payroll system but my problem is what code can i put in vb if biometric fingerprint i use to montor the employee in and out what code i put thanks >>..have a nice day.
Accusoft (Pegasus)
try www.accusoft.com to scan the finger print
hye...can anybody help me??
i'm new in using VB6.... i have to make a project from VB6.the project is about calculating area....but i know nothing about how to do that...can anyone help me???
re VB area
I have completed a full "calculations and Conversions" program written completelly in VB6. Part of the program calculates and converts area
hello!
i'm a new practitioner of VB6. can anybody help me on how to make this game, HANGMAN????? thank you!
hi,im willing to help u..my
hi,im willing to help u..my email is dieoom01@gmail.com
i must warn u im only 16 but im an expert in vb
Help Please.
Could you please email me the full code for this game? I have tried download here thing but it doesn't show me any codes .. the files are not opening.
I request you to please send me the code for this game asap...
email it to:
farwaf10@gmail.com
project on institute
willlwill u please help me in making my project...that will be a full erp project of any institute
thank you
thank you
accounting software!!
hello..hope you can help me with my project to make an application of VB6 in accounting program..thanx so much!!
Accounting Software
Oh!!!
Yes,
You can contact me for accounting software source code
thanx
Billing project In VB
Thanks For Help
i want to create a Billing software in vb
so plz help me how can i add combo list of product in bill format
Thanks with regard
Ankit Kumar
ankit_nzcc@rediffmail.com
+919780895996
email
pls email the code this program at limpsnipper_angel16@yahoo.com.thanks...
hi!!!!!
,,hi can you send me the code of this game,,im begging you to send to me the code,,, thank you very much if you granted my wish..
plsssss...
can u pls e-mail me the code for this one????? pls... I'm begging u.... i just want to know it and understand the coding of it.... plsssss.... "devil_triperz@yahoo.com" for ur reply....
You can download the source
You can download the source code above. Where it says HERE.
Bugs
it needs to bee debuged
Post new comment