MiniGame-Madness
Public Member Functions | List of all members
Hangman Class Reference

Class representing the Hangman game. More...

#include <hangman.h>

Public Member Functions

 Hangman (IScreenBuffer *sb)
 
void clearScreen ()
 Clears the screen using the ScreenBuffer class.
 
void displayHangman (int wrongGuesses)
 Displays the hangman figure based on the number of wrong guesses. More...
 
std::string getRandomWord (const std::string &filename)
 Retrieves a random word from a specified text file. More...
 
void playHangman (const std::string &difficulty)
 Main gameplay loop for the Hangman game. More...
 
bool isYes (const std::string &response)
 Checks if the response is a "yes". More...
 
bool isNo (const std::string &response)
 Checks if the response is a "no". More...
 
void hangman ()
 Runs the Hangman game.
 

Detailed Description

Class representing the Hangman game.

Member Function Documentation

◆ displayHangman()

void Hangman::displayHangman ( int  wrongGuesses)

Displays the hangman figure based on the number of wrong guesses.

Parameters
wrongGuessesThe number of wrong guesses made by the player.

◆ getRandomWord()

std::string Hangman::getRandomWord ( const std::string &  filename)

Retrieves a random word from a specified text file.

Parameters
filenameThe name of the file containing the words.
Returns
A randomly selected word from the file.

◆ isNo()

bool Hangman::isNo ( const std::string &  response)

Checks if the response is a "no".

Parameters
responseThe response string to check.
Returns
True if the response is "no", false otherwise.

◆ isYes()

bool Hangman::isYes ( const std::string &  response)

Checks if the response is a "yes".

Parameters
responseThe response string to check.
Returns
True if the response is "yes", false otherwise.

◆ playHangman()

void Hangman::playHangman ( const std::string &  difficulty)

Main gameplay loop for the Hangman game.

Parameters
difficultyThe difficulty level selected by the player.

The documentation for this class was generated from the following files: