LECTURE_13_CS113_2010 - EXAMPLE PROJECT HANGMAN The goal of...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: EXAMPLE PROJECT HANGMAN The goal of this project was to write a graphically based game of hangman using Matlab. The computer program opens a figure window, sets the axes properly and then draws the "hangman" gallows. The computer loads a dictionary of words that have been previously generated and saved as a text file. The computer then selects any of those words randomly and puts the correct number of dashes in the figure window. The player can then start guessing letters. If the letter appears in the word then the computer puts the letter in its proper location. If not then the computer adds one more body part to the hangman. I used 6 body parts (e.g. head-neck, body, arms, legs, feet and hands). If the entire body is completed then the player loses. If the player guesses the word before the body is completed then the player wins. After guessing a letter the letter should be removed from the available alphabet so that it is not guessed again. The user should be alerted if they try to guess the same letter more than once. EXAMPLE PROJECT HANGMAN USEFUL TIPS IN BUILDING LARGER PROGRAMS (1) Program in small steps. Complete on section of the code and test it before moving on the next one. If you try to write the entire code in one shot without testing you will find it hard to locate and fix errors (i.e. bugs) (2) Use modular programming whenever possible....
View Full Document

This note was uploaded on 02/29/2012 for the course CSC 113 taught by Professor Phillipregali during the Fall '10 term at Catholic University of America.

Page1 / 17

LECTURE_13_CS113_2010 - EXAMPLE PROJECT HANGMAN The goal of...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online