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

Class representing the Word Scrambler game. More...

#include <wordScrambler.h>

Public Member Functions

 WordScrambler ()
 Default constructor.
 
 WordScrambler (ScreenBuffer *buffer)
 Constructor that accepts an external ScreenBuffer.
 
 ~WordScrambler ()
 Destructor to clean up internal ScreenBuffer if we own it.
 
void setScreenBuffer (ScreenBuffer *buffer)
 Sets the ScreenBuffer to be used by the game.
 
void clearScreen ()
 Clears the screen using the ScreenBuffer class.
 
std::string getRandomWord (const std::string &filename)
 Retrieves a random word from a specified text file. More...
 
std::string scrambleWord (const std::string &word)
 Scrambles the characters in a given word. More...
 
std::string toLowerCase (const std::string &str)
 Converts a string to lowercase. More...
 
void displayHint (const std::string &word)
 Displays a hint with the first, middle, and last characters of the word. More...
 
void playWordScrambler (const std::string &difficulty)
 Main gameplay loop for the Word Scrambler game. More...
 
void run ()
 Runs the Word Scrambler game.
 

Detailed Description

Class representing the Word Scrambler game.

Member Function Documentation

◆ displayHint()

void WordScrambler::displayHint ( const std::string &  word)

Displays a hint with the first, middle, and last characters of the word.

Parameters
wordThe word for which the hint is generated.

◆ getRandomWord()

std::string WordScrambler::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.

◆ playWordScrambler()

void WordScrambler::playWordScrambler ( const std::string &  difficulty)

Main gameplay loop for the Word Scrambler game.

Parameters
difficultyThe difficulty level selected by the player.

◆ scrambleWord()

std::string WordScrambler::scrambleWord ( const std::string &  word)

Scrambles the characters in a given word.

Parameters
wordThe word to be scrambled.
Returns
A scrambled version of the word.

◆ toLowerCase()

std::string WordScrambler::toLowerCase ( const std::string &  str)

Converts a string to lowercase.

Parameters
strThe string to be converted.
Returns
The lowercase version of the string.

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