Coder Social home page Coder Social logo

number_guesser's Introduction

Number Guesser Game

Introduction

This is a game in which the computer chooses a random number between 1 and 100, and you are supposed to guess what number it has chosen each time. You start with 100 scores, and for each wrong guess, you will lose 10 scores.

This solution provides a Modular approach to code this game.

Prerequisits

This game doesn't need any specific requirements to be run on your machine

Directory Structure

number-guesser project/
|-- src/
| |-- main.py
| |-- utils/
| | |-- input_validator.py
| | |-- random_generator.py
| | |-- time_calculator.py
| |-- game_logic/
| | |-- hint_generator
| | |-- score_calculator
|-- README.md
|-- requirements.txt

How to Run

  1. Navigate to the project main directory (NUMBER-GUESSER-PROJECT)
  2. Add current directory to the PYTHONPATH and run main.py
export PYTHONPATH=$PYTHONPATH:$(pwd)
python src/main.py
  1. Follow on-screen prompt to run the game

Modules

  • src/main.py: The main entry point of the game, it handles the game loop, user input, and display
  • src/game_logic/: It contains core game logic
    • hint_generator.py: Generates hints based on user's input
    • score_calculator.py: calculates the score of the user based on the number of tries
  • src/utils/: It contains the utility functions
    • input_validator.py: It checks if user's input is valid or not, and provides appropriate feedback if not.
    • random_generator.py: It generates random numbers that user need to guess
    • time_calculator.py: It calculates the time that user will spend palying

number_guesser's People

Contributors

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