This is hangman application was built using React and TypeScript. The game randomly selects a word from a predefined list, and your goal is to guess the word letter by letter. Be careful, though – you have only get 6 incorrect guesses before the hangman is complete.
- Randomly selects a word from a predefined list.
- Tracks guessed letters and updates the hangman drawing accordingly.
- Informs you if you win or lose the game.
- Supports both keyboard and mouse inputs for letter guesses.
- Responsive design created through CSS modules for an optimal gaming experience.
- Clone this repository to your local machine.
git clone https://github.com/acktreptow/hangman.git- Navigate to the project directory.
cd hangman- Install the required dependencies.
npm install- Run the application by using the following command:
npm run dev- The game will start with a randomly selected word.
- Use the keyboard to guess letters.
- Each incorrect letter adds to the hangman drawing.
- Win the game by guessing the entire word before the hangman is complete.
- Lose the game by incorrectly guessing 6 letters.
- Refresh the page or press Enter to start a new game.
Feel free to customize the game by modifying the code. You can add more words to the wordList.json file, change the styling in .module.css files, or tweak the game logic in App.tsx.
If you'd like to contribute to this project, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes and submit a pull request.
- Ensure your code passes any existing tests.
I would like to add a difficulty mode (number of guesses) and perhaps different genres of lists of words (sports/movies) etc.
If you have any questions or feedback, please reach out to me at alex@treptow.dev
This Hangman React application is open-source and available under the MIT License. Feel free to use, modify, and distribute it as you see fit. Enjoy playing!