GithubHelp home page GithubHelp logo

python-project-49's Introduction

logo

Mind Games

Five CLI math games

Actions Status Maintainability

AboutInstallationUsageAdditionally

Table of Contents

About

"Mind Games" is a set of five console games based on the popular mobile brain-pumping apps. Each game asks questions that need to be answered correctly. After three correct answers, the game is considered completed. Incorrect answers end the game and prompt you to play it again.

Games:

  • Brain Even: Determining an even number.
  • Brain Calc: Arithmetic expressions to be calculated.
  • Brain GCD: Determining the largest common divisor.
  • Brain Progression: Finding missing numbers in a sequence of numbers.
  • Brain Prime: Determining a prime number.

Example:

>> brain-progression

Welcome to the Brain Game!
What number is missing in this progression?
May I have your name? Andrey
Hello, Andrey!
Question: 14 .. 18 20 22 24 26 28
Your answer: 16 # The user enters the answer
Correct!
Question: 5 6 7 8 9 .. 11 12
Your answer: 10 # The user enters the answer
Correct!
Question: 12 15 18 21 .. 27 30 33
Your answer: 24 # The user enters the answer
Correct!
Congratulations, Andrey!

Built With

  • Python
  • Poetry
  • prompt
  • flake8

Installation

Prerequisites

Python

Before installing the package make sure you have Python version 3.8 or higher installed:

>> python --version
Python 3.8.0+

Poetry

The project uses the Poetry dependency manager. To install Poetry use its official instruction.

Package

To use the package, you need to clone the repository to your computer. This is done using the git clone command. Clone the project:

>> git clone https://github.com/venyxD/python-project-49.git

Then you have to build the package and install it:

>> cd python-project-49
>> poetry build
>> python3 -m pip install --user dist/*.whl

Usage

Brain Even

A random number is shown to the user. And he needs to answer yes if the number is even, or no if it is odd.

>> brain-even

Answer "yes" if the number is even, otherwise answer "no".
Question: 98
Your answer: no
'no' is wrong answer ;(. Correct answer was 'yes'.
>> brain-even

Answer "yes" if the number is even, otherwise answer "no".
Question: 82
Your answer: yes
Correct!

Brain Calc

The user is shown a random mathematical expression, for example 25 + 17 which needs to be calculated and written down the correct answer.

>> brain-calc

What is the result of the expression?
Question: 3 + 15
Your answer: 315
'315' is wrong answer ;(. Correct answer was '18'.
>> brain-calc

What is the result of the expression?
Question: 5 * 15
Your answer: 75
Correct!

Brain GCD

The user is shown two random numbers, for example, 25 50. The user must calculate and enter the greatest common divisor of these numbers.

>> brain-gcd

Find the greatest common divisor of given numbers.
Question: 95 96
Your answer: 5
'5' is wrong answer ;(. Correct answer was '1'.
>> brain-gcd

Find the greatest common divisor of given numbers.
Question: 56 91
Your answer: 7
Correct!

Brain Progression

A series of numbers that form an arithmetic progression is shown to the player, replacing any of the numbers with two dots. The player must enter this number.

>> brain-progression

What number is missing in the progression?
Question: 13 22 31 40 49 58 67 76 85 .. 103
Your answer: 100
'100' is wrong answer ;(. Correct answer was '94'.
>> brain-progression

What number is missing in the progression?
Question: 11 16 .. 26 31 36 41 46
Your answer: 21
Correct!

Brain Prime

A random number is shown to the user. He needs to answer yes if the number is prime, or no if it is not.

>> brain-prime

Answer "yes" if given number is prime. Otherwise answer "no".
Question: 66
Your answer: yes
'yes' is wrong answer ;(. Correct answer was 'no'.
>> brain-prime

Answer "yes" if given number is prime. Otherwise answer "no".
Question: 22
Your answer: no
Correct!


Additionally

Dependencies

  • python = "^3.10"
  • prompt = "^0.4.1"

Dev Dependencies

  • flake8 = "^5.0.4"

Makefile Commands

make build
Build the Poetry package.
make package-install
Install the package in the user's environment.
make lint
Check code with flake8 linter.

Project Tree
.
├── Makefile
├── README.md
├── brain_games
│   ├── __init__.py
│   ├── cli.py
│   ├── engine.py
│   ├── games
│   │   ├── calc.py
│   │   ├── even.py
│   │   ├── gcd.py
│   │   ├── prime.py
│   │   └── progression.py
│   └── scripts
│       ├── __init__.py
│       ├── brain_calc.py
│       ├── brain_even.py
│       ├── brain_games.py
│       ├── brain_gcd.py
│       ├── brain_prime.py
│       └── brain_progression.py
├── poetry.lock
├── pyproject.toml
└── setup.cfg

:octocat: This is the first training project of the "Python Developer" course on Hexlet.io

GitHub @ivnvxd  ·  LinkedIn @Andrey Ivanov

python-project-49's People

Contributors

ivnvxd avatar

Stargazers

 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.