From 1c124b2c913bde53e5321265d3919f2c2146d16e Mon Sep 17 00:00:00 2001 From: Ivan Soshnikov Date: Wed, 16 Aug 2023 00:16:57 +0300 Subject: [PATCH] Initial commit --- .gitignore | 210 ++++++++++++++++++++++++++++++++++++++++++++ .vscode/launch.json | 17 ++++ Readme.md | 1 + main.py | 49 +++++++++++ requirements.txt | 1 + 5 files changed, 278 insertions(+) create mode 100644 .gitignore create mode 100644 .vscode/launch.json create mode 100644 Readme.md create mode 100644 main.py create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a79f51f --- /dev/null +++ b/.gitignore @@ -0,0 +1,210 @@ +# Created by https://www.toptal.com/developers/gitignore/api/python,linux,visualstudiocode +# Edit at https://www.toptal.com/developers/gitignore?templates=python,linux,visualstudiocode + +### Linux ### +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### Python ### +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ + +### Python Patch ### +# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration +poetry.toml + +# ruff +.ruff_cache/ + +# LSP config files +pyrightconfig.json + +### VisualStudioCode ### +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +!.vscode/*.code-snippets + +# Local History for Visual Studio Code +.history/ + +# Built Visual Studio Code Extensions +*.vsix + +### VisualStudioCode Patch ### +# Ignore all local history of files +.history +.ionide + +# End of https://www.toptal.com/developers/gitignore/api/python,linux,visualstudiocode diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..eb4f301 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,17 @@ +{ + // Используйте IntelliSense, чтобы узнать о возможных атрибутах. + // Наведите указатель мыши, чтобы просмотреть описания существующих атрибутов. + // Для получения дополнительной информации посетите: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + + { + "name": "Main.DBG", + "type": "python", + "request": "launch", + "program": "${workspaceFolder}/main.py", + "console": "integratedTerminal", + "justMyCode": true + } + ] +} \ No newline at end of file diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..ec373f9 --- /dev/null +++ b/Readme.md @@ -0,0 +1 @@ +# Лисичка сажает морковку diff --git a/main.py b/main.py new file mode 100644 index 0000000..b106eba --- /dev/null +++ b/main.py @@ -0,0 +1,49 @@ + +from random import randint +from colorama import Fore, Back, Style, init as coloramaInit + +gryadka = [] +# "л" - лунка +# "м" - молодая морковка +# "М" - созревшая морковка +# "ж" - жук +# "" - пустая ячейка +gс_types = ["л", "м", "М", "ж", ""] + + +def generate_random_gryadka(gl: int): + # сгенерировать случайную грядку + gryadka.clear() + for i in range(gl): + gryadka.append(gс_types[randint(0, len(gс_types)-1)]) + + +def print_slot(val: str): + # Напечатать ячейку грядки + if val == "м": + print(Fore.WHITE, Back.GREEN, "м ", end="") + elif val == "М": + print(Fore.RED, Back.YELLOW, "М ", end="") + elif val == "л": + print(Fore.CYAN, Back.BLACK, "л ", end="") + elif val == "ж": + print(Fore.WHITE, Back.RED, "ж ", end="") + else: + print(Fore.BLUE, Back.BLACK, " ", end="") + + +def printCell(val: str): + print_slot(val) + print(Style.RESET_ALL, end="") + + +def print_gryadka(): + for v in gryadka: + printCell(v) + print() + + +if __name__ == "__main__": + coloramaInit() + generate_random_gryadka(20) + print_gryadka() diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e648e64 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +colorama==0.4.6 \ No newline at end of file