GithubHelp home page GithubHelp logo

h1b0b0 / hangman-game Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 298 KB

This GitHub repo houses a Python Hangman game. Guess words, earn points, and enjoy classic word-guessing fun.

License: MIT License

Python 100.00%
game hangman hangman-in-python python

hangman-game's Introduction

Hangman Game

This Python program implements a text-based version of the classic Hangman game. In Hangman, players guess letters to uncover a hidden word, and they have limited attempts to guess the correct word.

Table of Contents

Introduction

This Hangman game is written in Python and uses the OpenAI GPT-3.5 Turbo model for generating random words and assisting players during the game. It offers a simple command-line interface for playing.

Game Rules

  • You start with 0 points.
  • You can choose whether or not to set the language of the word.
  • The game selects a random word for you to guess.
  • You can guess letters or the entire word.
  • For each incorrect guess, you lose a point.
  • The game continues until you guess the word correctly or accumulate 11 incorrect guesses.
  • If you guess the word correctly, you win.
  • If you reach 11 incorrect guesses, the game ends, and you lose.

Installation

To run the Hangman game, follow these steps:

  1. Clone the repository:

    git clone https://github.com/H1B0B0/hangman-game.git

  2. Navigate to the project directory:

    cd hangman-game

  3. Install the required Python packages:

    pip install openai click

  4. Set up your OpenAI API key as an environment variable:

    • Linux: export OPENAI=your-api-key
    • Windows: setx OPENAI "Variable value"
  5. Run the game:

    • Linux: python3 hangman.py
    • Windows: py -3 hangman.py

Usage

Once the game is running, follow the prompts to play. Here's a brief overview of how to play:

  1. Start the game by typing "yes" when prompted.

  2. Optionally, choose to set the language of the word by entering "yes" or "no."

  3. If you chose to set the language, enter the desired language.

  4. The game selects a random word, and you'll see underscores representing the letters of the word.

  5. Start guessing by entering letters or the entire word.

  6. For each incorrect guess, you lose a point, and part of the hangman figure is drawn.

  7. Continue guessing until you guess the word correctly or accumulate 11 incorrect guesses.

  8. If you guess the word correctly, you win the game.

  9. If you reach 11 incorrect guesses, the game ends, and you lose.

Configuration

You can configure the game by setting your OpenAI API key as an environment variable and customizing the GPT-3.5 Turbo model. You can also modify the game's behavior by editing the hangman.py file.

License

This Hangman game is open-source software released under the MIT License. You can find the full license details in the LICENSE file.

Enjoy playing Hangman! If you have any questions or encounter issues, please feel free to open an issue in the GitHub repository.

hangman-game's People

Contributors

h1b0b0 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.