Data science project 0: A guess number game example with primitive self-testing
Project description
Data science project 0: A guess number game example with primitive self-testing
A guess number game example with primitive self-testing
Requrements
- Python 3.7+
- numpy
- setuptools, wheel
Installation
Use the package manager pip to install datascience-project-0-github-guessnumber
.
Installation of the package datascience-project-0-github-guessnumber
pip install datascience-project-0-github-guessnumber
View at: https://pypi.org/project/datascience-project-0-github-guessnumber/
Installation from a local copy of the repository
git clone https://github.com/dmitry-v-vlasov/data-science-course.git
cd data-science-course
cd module_0
cd datascience_project_0_github_guessnumber
pip install .
After the package installation
Type the following command in order to display help text.
datascience_guessnumber -h
Here is a copy of the help text of the datascience_guessnumber
command.
usage: datascience_guessnumber [-h] [-n INTEGER] [-s "[a, b]"] [-g LIST] [-v] [-vv] [--version]
__ _ _ _ ___ ___ ___ _ __ _ _ _ __ ___ | |__ ___ _ __
/ _` | | | |/ _ \/ __/ __| | '_ \| | | | '_ ` _ \| '_ \ / _ \ '__|
| (_| | |_| | __/\__ \__ \ | | | | |_| | | | | | | |_) | __/ |
\__, |\__,_|\___||___/___/ |_| |_|\__,_|_| |_| |_|_.__/ \___|_|
|___/
Guess Number game strategies demonstration
optional arguments:
-h, --help show this help message and exit
-n INTEGER, --attempts INTEGER number of attempts to guess a number
-s "[a, b]", --segment "[a, b]" a segment of integer numbers surrounded with double quotes(!!)
-g LIST, --game-strategies LIST a comma separated list of strategies (without spaces!!).
The supported strategy names: random-snail,binary-search,ternary-search
-v, --verbose set loglevel to INFO
-vv, --very-verbose set loglevel to DEBUG
--version show program's version number and exit
© Copyright 2020, Dmitry Vlasov
Author email: dmitry.v.vlasov@gmail.com
Licence: MIT
--------------------------------------------
Screenshot:
Usage
Calling the command datascience_guessnumber
without arguments
datascience_guessnumber
Execution result:
Ваш алгоритм "random-snail" угадывает число в среднем за 30 попыток при 30 итерациях цикла.
Ваш алгоритм "binary-search" угадывает число в среднем за 4 попыток при 4 итерациях цикла.
Ваш алгоритм "ternary-search" угадывает число в среднем за 5 попыток при 2 итерациях цикла.
Вывод: наиболее эффективная стратегия по количеству _единичных_ угадываний: binary-search
Screenshot:
Specifying game strategies
datascience_guessnumber --game-strategies random-snail,binary-search
Execution result:
Ваш алгоритм "random-snail" угадывает число в среднем за 30 попыток при 30 итерациях цикла.
Ваш алгоритм "binary-search" угадывает число в среднем за 4 попыток при 4 итерациях цикла.
Вывод: наиболее эффективная стратегия по количеству _единичных_ угадываний: binary-search
Screenshot:
Specifying attempts number and number segment
datascience_guessnumber --attempts 1000 --segment "[1, 100]"
Execution result:
Ваш алгоритм "random-snail" угадывает число в среднем за 30 попыток при 30 итерациях цикла.
Ваш алгоритм "binary-search" угадывает число в среднем за 4 попыток при 4 итерациях цикла.
Ваш алгоритм "ternary-search" угадывает число в среднем за 5 попыток при 2 итерациях цикла.
Вывод: наиболее эффективная стратегия по количеству _единичных_ угадываний: binary-search
Screenshot:
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file datascience_project_0_github_guessnumber-0.1.4-py3-none-any.whl
.
File metadata
- Download URL: datascience_project_0_github_guessnumber-0.1.4-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 758071d04b5195ed2e016a047eb80fd9ea3c603f8d4cfcdadb80c102dc9f7995 |
|
MD5 | c6fdbcff62e2d0ab3b0930eecf39d4fc |
|
BLAKE2b-256 | d72803b40d146a32f0470da4b1f78b02b4fa4c50c8c80442853099c39a120f4b |