CSCD-Lab 9 Solution

$30.00 $24.00

You will create the game of Hangman. The game is played in the following fashion: Your program starts Player one enters their name (must use fgets) Player one enters a single word for the other player to guess (must use fgets) Player two enters their name (must use fgets) Player 2 has a maximum of…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Description

5/5 – (2 votes)

You will create the game of Hangman. The game is played in the following fashion:

Your program starts

  1. Player one enters their name (must use fgets)

  2. Player one enters a single word for the other player to guess (must use fgets)

  3. Player two enters their name (must use fgets)

  1. Player 2 has a maximum of 7 tries to guess the word. If player 2 guesses the word in 7 or less tries, a message of congratulations is displayed. If the word is not guessed after 7 tries, a losing message is displayed along with what the correct word was.

The option to play the game again is then given (yes/no) – Must ensure yes or no only case insensitive

Specifications:

  • An introduction is given (by me) that specifies the rules of the game.

  • I have provided utils.h and utils.c – You must use my utils.c to strip the carriage return from the String and to clean the input buffer.

  • Dashes or underlines will be used to represent the number of characters in the word.

  • As player 2 makes correct guesses, the dashes of the word will be replaced by the correctly guessed letters. For example, if “pepperoni” is the word to guess, this is what should be displayed:

Your word contains 9 letters.

———

Available Letters: abcdefghijklmnopqrstuvwxyz

Enter a letter: p

p – p p – – – – –

Available Letters: abcdefghijklmno qrstuvwxyz

Enter a letter: a

Incorrect guess! You have 6 more tries!

p – p p – – – – –

Available Letters: bcdefghijklmno qrstuvwxyz

Enter a letter: e

p e p p e – – – –

Available Letters: bcd fghijklmno qrstuvwxyz

Enter a letter: t

Incorrect guess! You have 5 more tries!

p e p p e – – – –

Available Letters: bcd fghijklmno qrs uvwxyz

Enter a letter: i

p e p p e – – – i

Available Letters: bcd fgh jklmno qrs uvwxyz

Enter a letter: o

p e p p e – o – i

Available Letters: bcd fgh jklmn qrs uvwxyz

Enter a letter: r

p e p p e r o – i

Available Letters: bcd fgh jklmn q s uvwxyz

Enter a letter: n

p e p p e r o n i

Congratulations! You guessed the word!

  • As shown above, if the player misses a letter, tell her/him the guess was incorrect.

  • Show how many guesses remain.

  • Show the letters that are still available.

  • You may not change cscd240Lab9.c, utils.h, utils.c, or lab9.h in any fashion

  • Screen user input to make sure only letters are entered, and yes/no are entered

  • Ensure player 2 does not select a letter that has already been chosen.

  • The user will enter both upper and lower case letters what will be displayed as lower case letters.

  • You may only use strlen from string.h

  • There are helper functions in lab9.c that are not called from main but are used as part of the game play. You must write the following and use them in your solution.

o char makeCharLowerCase(char a);

o int isLetterInWord(char, char *, char *, int); o int isWinner(char *);

  • You will use one dimensional arrays of characters (100 characters MAX)

    1. One for player 1 name o One for player 2 name

o One for the word to be guessed

o One for the characters to be guessed (only need 27)

  • You will use a multiple file format

      • cscd240Lab9.c

      • lab9.h

      • lab9.c

      • utils.h

      • utils.o

To Turn In

Zip file containing the Lab9 folder – which contains

  • All files necessary to compile your code

  • My Makefile

  • At least 2 output runs that show a the word guessed in 7 or fewer tries, the word not guessed in 7 or fewer tries — named cscd240Lab9out.txt

CSCD-Lab 9 Solution
$30.00 $24.00