Coder Social home page Coder Social logo

hangman's Introduction

Hangman Game

This project is a console-based Hangman game. Players can choose to guess words from a list of countries or animals.

Setup

  1. Clone or download this project to your computer.
  2. Open the project in Visual Studio or any C# IDE.
  3. Run the project.

How to Play

When you start the game, you can choose from the following options:

  1. Guess countries
  2. Guess animals
  3. Exit

Guessing Words

  1. Select either "Guess countries" or "Guess animals".
  2. You have 6 lives to guess the word correctly.
  3. Enter letters one at a time to guess the word.
  4. If you guess a letter correctly, it will be revealed in the word.
  5. If you guess a letter incorrectly, you lose a life.
  6. The game continues until you either guess the word correctly or run out of lives.
  7. You can exit the game at any time by entering the number 3 when prompted to guess a letter.

Exiting the Game

  1. Select "Exit" to close the game.

Code Overview

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.

Categories

The game uses a static class Category to represent the possible categories (Animal, Country).

Constants

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 of animalList and countryList.
  • initialAlphabet: The alphabet used for displaying available letters.
  • initialPlayerMaxGuess: The maximum number of incorrect guesses allowed (initially set to 6).

Enjoy the game!

hangman's People

Contributors

dogaaydinn avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.