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.

/media/uploads/pprasad7/_scaled_imag0070.jpg /media/uploads/pprasad7/_scaled_hangman.png

Components

  • mbed
  • uVGA II board
  • Text LCD panel
  • PS2 break out board
  • PS2 keyboard
  • Piezo buzzer

Connections

mbedPS2mbedBuzzer power amplifierExternal supply
Vu+5vGNDGND
GNDGNDp22Control
p12CLKVcc+5V
p11DATGNDGND

/media/uploads/pprasad7/_scaled_ps2.png /media/uploads/pprasad7/_scaled_picture1.png

mbedText LCD
GNDGND
VuVcc
GND via 1k resistorVO
p24RS
GNDRW
p26E
n/cD0
n/cD1
n/cD2
n/cD3
p27D4
p28D5
p29D6
p30D7

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.