This project is a console-based Hangman game. Players can choose to guess words from a list of countries or animals.
- Clone or download this project to your computer.
- Open the project in Visual Studio or any C# IDE.
- Run the project.
When you start the game, you can choose from the following options:
- Guess countries
- Guess animals
- Exit
- Select either "Guess countries" or "Guess animals".
- You have 6 lives to guess the word correctly.
- Enter letters one at a time to guess the word.
- If you guess a letter correctly, it will be revealed in the word.
- If you guess a letter incorrectly, you lose a life.
- The game continues until you either guess the word correctly or run out of lives.
- You can exit the game at any time by entering the number 3 when prompted to guess a letter.
- Select "Exit" to close the game.
The main logic of the game is implemented in the following methods:
GuessWord
: Handles the game logic for guessing words based on the selected category (animals or countries).UpdateGuessedWord
: Updates the guessed word with the correct letters guessed by the player.
The game uses a static class Category
to represent the possible categories (Animal, Country).
The following constants are defined at the beginning of the code:
animalList
: List of animals to be guessed.countryList
: List of countries to be guessed.allWords
: Combination ofanimalList
andcountryList
.initialAlphabet
: The alphabet used for displaying available letters.initialPlayerMaxGuess
: The maximum number of incorrect guesses allowed (initially set to 6).
Enjoy the game!