Two Player Hangman
Overview
We designed a two player hangman game with the graphics running on a VGA and the text being displayed on the Text LCD. The input is from a PS2 keyboard. One user enters a word which must be guessed by the second user. A buzzer is also included to indicate winning or losing. A short single buzz indicates a loss and multiple beeps indicate that the player has guessed the right word.
Components
- mbed
- uVGA II board
- Text LCD panel
- PS2 break out board
- PS2 keyboard
- Piezo buzzer
Connections
mbed | PS2 | mbed | Buzzer power amplifier | External supply |
---|---|---|---|---|
Vu | +5v | GND | GND | |
GND | GND | p22 | Control | |
p12 | CLK | Vcc | +5V | |
p11 | DAT | GND | GND |
mbed | Text LCD |
---|---|
GND | GND |
Vu | Vcc |
GND via 1k resistor | VO |
p24 | RS |
GND | RW |
p26 | E |
n/c | D0 |
n/c | D1 |
n/c | D2 |
n/c | D3 |
p27 | D4 |
p28 | D5 |
p29 | D6 |
p30 | D7 |
n/c indicates not connected. The top left pin is gnd and the last pin is D7.
Description
The input to the mbed is given through the PS/2 keyboard. The first player goes first and enters the word. The word is stored in an array which scans through it and figures out the vowels. The word is displayed as vowels and dashes on the LCD display. Then the second player starts playing and types in an alphabet. If the alphabet is matching to the original word then that alphabet is printed on its respective place on the TextLCD. If it does not match then then the hangman is drawn. We use the graphic function in the uVGAII library to draw it sequentially according to the number of failed try. We have given 10 tries to the player. Once those run out the hangman is complete and there is a long beep indicating that the game is over and the Player 2 has lost.TextLCD displays "GAME OVER".If the player manages to guess all the alphabets right the game multiple beeps sound and the TextLCD displays "YOU WIN". After game over or win the program waits for few seconds and the gives the player an option to play again. If the player selects y it starts again from the start.Else it terminates the program.
Import programHangman
Two Player Hangman
Future Steps
A speech to text converter can be augmented into the game. An easyVR chip can used for this purpose. Users can play the game without having to type in the text using a keyboard.
References
Please log in to post comments.