From 375cad66c5c0b380aafcbb279c2456f230a707b7 Mon Sep 17 00:00:00 2001 From: Nikolov-A Date: Thu, 3 Jun 2021 17:24:13 +0200 Subject: [PATCH 1/5] 03/06/2021 --- .gitignore.txt | 154 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 154 insertions(+) create mode 100644 .gitignore.txt diff --git a/.gitignore.txt b/.gitignore.txt new file mode 100644 index 0000000..2631c35 --- /dev/null +++ b/.gitignore.txt @@ -0,0 +1,154 @@ + +# Created by https://www.toptal.com/developers/gitignore/api/python +# Edit at https://www.toptal.com/developers/gitignore?templates=python + +### Python ### +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +parts/ +sdist/ +var/ +wheels/ +pip-wheel-metadata/ +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/ +pytestdebug.log + +# 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/ +doc/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +.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 +#poetry.lock + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +# .env +.env/ +.venv/ +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ +pythonenv* + +# 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/ + +# operating system-related files +# file properties cache/storage on macOS +*.DS_Store +# thumbnail cache on Windows +Thumbs.db + +# profiling data +.prof + + +# End of https://www.toptal.com/developers/gitignore/api/python \ No newline at end of file From 69752f72315a3d9212d3336f3086ffcaa6fae9a0 Mon Sep 17 00:00:00 2001 From: Nikolov-A Date: Thu, 3 Jun 2021 20:18:35 +0200 Subject: [PATCH 2/5] 03/06/2021 --- README.md | 47 ++++++++++++++ your-project/guess_the_number.py | 108 +++++++++++++++++++++++++++++++ 2 files changed, 155 insertions(+) create mode 100644 README.md create mode 100644 your-project/guess_the_number.py diff --git a/README.md b/README.md new file mode 100644 index 0000000..884c281 --- /dev/null +++ b/README.md @@ -0,0 +1,47 @@ +Ironhack Logo + +# Guess the secret number +*[Aleksandar Nikolov]* + +*[Data Analytics May 2021, Remote , 04.06.2021]* + +## Content +- [Project Description](#project-description) +- [Rules](#rules) +- [Workflow](#workflow) +- [Organization](#organization) +- [Links](#links) + +## Project Description +The goal of the project is to build a simple console game + +## Rules +Guess the secret number in the magician's hat. If your guess is higher or lower, you'll get a hint. + +## Workflow +1. Research about the game. + +2. Pseudocode on a very conceptual level + +3. Code the game + +4. Test it +4.1. Handling some edge cases and errors + +5. Prepare presentation + +6. Update github + + +## Organization +I used Trello to track my progress + +The game consist of only one file "guess_the_number.py" that can be found in "your-project" folder. + + +## Links + + +[Repository](https://github.com/Nikolov-A/Project-Week-1-Build-Your-Own-Game) +[Google Slides](https://docs.google.com/presentation/d/1ySCRvQTAKD5PsBDTiBjcrFfUXWj_vJmhlK3D57qNrmw/edit?usp=sharing) +[Trello](https://trello.com/b/vw8HCbSZ/project-1-magic-number-an) diff --git a/your-project/guess_the_number.py b/your-project/guess_the_number.py new file mode 100644 index 0000000..8f73d61 --- /dev/null +++ b/your-project/guess_the_number.py @@ -0,0 +1,108 @@ +def magic_number(level): + import random + + magic_number = 0 + + if level == 1: + magic_number = random.randint(1, 10) + elif level == 2: + magic_number = random.randint(1, 100) + elif level == 3: + magic_number = random.randint(-1000, 1000) + + return magic_number + + +def turns(level): + turns = 0 + message = '' + + if level == 1: + turns = 5 + message = 'You will have 5 turns\n' + elif level == 2: + turns = 7 + message = 'You will have 7 turns\n' + elif level == 3: + turns = 11 + message = 'You will have 11 turns\n' + + return turns, message + + +def pick_a_number_message(level): + message = '' + + if level == 1: + message = 'Pick a number between 1 and 10: ' + elif level == 2: + message = 'Pick a number between 1 and 100: ' + elif level == 3: + message = 'Pick a number between -1000 and 1000: ' + + return message + + +how_to_play_the_game = '''The FunBrain Magician will pick a secret number and put it in his hat. +Your task is to guess what number it is. +If your guess is higher or lower, you'll get a hint.\n''' + +print(how_to_play_the_game) + +level = input('''Pick a level + +1: numbers from 1 to 10 +2: numbers from 1 to 100 +3: numbers from -1000 to 1000 + +You have to choose between 1, 2 or 3: +Your choice is: ''') + +while True: + try: + + level = int(level) + + if level < 1 or level > 3: + print("You have to enter 1 or 2 or 3 other options aren't allowed:") + level = input('Your choice is: ') + else: + break + + except ValueError: + print("You have to enter 1 or 2 or 3 other options aren't allowed:") + level = input('Your choice is: ') + +magic_number = magic_number(level) +turns, turns_message = turns(level) +message = pick_a_number_message(level) + +print(f'\n{turns_message}') + +guess = None +current_turn = 0 + +print(magic_number) + +while current_turn < turns and not guess == magic_number: + try: + guess = int(input(f'{message}')) + + if guess < magic_number: + print('You need to guess higher.\n') + elif guess > magic_number: + print('You need to guess lower.\n') + else: + break + + current_turn += 1 + + except ValueError: + print('Invalid input, try again\n') + +if current_turn == turns: + print("Sorry you didn't guess the magic number") + print(f"The magic number was {magic_number}") +else: + print('\nGreat you guess it!') + print(f'Magic number was {magic_number}') From 96ba5114b6b27196455ee1eac3d74a62e1bdd105 Mon Sep 17 00:00:00 2001 From: Nikolov-A Date: Thu, 3 Jun 2021 20:24:52 +0200 Subject: [PATCH 3/5] 03/06/2021 --- Kick-Off.md | 94 ------------------------------------------ README.md | 6 ++- your-project/README.md | 34 --------------- 3 files changed, 5 insertions(+), 129 deletions(-) delete mode 100644 Kick-Off.md delete mode 100644 your-project/README.md diff --git a/Kick-Off.md b/Kick-Off.md deleted file mode 100644 index f784834..0000000 --- a/Kick-Off.md +++ /dev/null @@ -1,94 +0,0 @@ -Ironhack Logo - -# Build your own game! - -## Content -- [Project Description](#project-description) -- [Games](#games) -- [Project Goals](#project-goals) -- [Requirements & Deliverables](#requirements-&-deliverables) -- [Mentoring](#mentoring) -- [Schedule](#schedule) -- [Presentation](#presentation) - -## Project Description -In this project, you will create your first software! -You are tasked with creating a **game** that interacts with the user, using functions and other basic python resources you have learned during the week. Your game will be able to take an input from the user and provide an output. - -You will also present your game to the class. - -## Games -You will be assigned one of the following games: - -* [Strong Random Password Generator](https://strongpasswordgenerator.com/) -* [Guess The Number](https://www.funbrain.com/games/guess-the-number) -* [Hangman](https://www.coolmathgames.com/0-hangman) -* [Message Encryption & Decryption](https://www.base64decode.org/) -* [Mastermind](https://www.webgamesonline.com/mastermind/) -* [Tic Tac Toe](https://www.google.com/search?q=tic+tac+toe&oq=tic+tac+toe&aqs=chrome..69i57j0l5.1876j0j4&sourceid=chrome&ie=UTF-8) -* [Blackjack](https://bicyclecards.com/how-to-play/blackjack/) -* [Soldier & Dice (Risk)](https://en.wikipedia.org/wiki/Risk_(game)#Attack_and_defense) - -## Project Goals -During this project you will: -* Fork and manage your own git repository. -* Build your own code from scratch. -* Put into practice the basic python concepts learned during the week. -* Get used to public presentations. - -## Requirements & Deliverables -The **mandatory** requirements that this project needs to satisfy are: -* The project must be planned. That is why creating a Kanban board is important. You can either do it manually (e.g. with post-its) or use an online tool like Trello. You can find a template for Trello [here](https://trello.com/b/pc2CNZTo/project-1-build-your-own-game). Remember that you **CAN'T CODE** until your project is planned. -* Your repository must be clean and organized; this means that it must include a *.gitignore* file and a README file and also have a functional file structure. You can easily create a *.gitignore* template [here](https://www.toptal.com/developers/gitignore). -* Your code must include at least one function. -* The project needs to be presented to your colleagues on the day of the presentation. - -The **mandatory** deliverables that you must turn in are: -* Link to the repository you used while working on your project. The repository must include all the files you used to build your game. Remember to commit often to avoid trouble in case you mess up: this means more than 1 commit! -* Link to Trello or picture of your Kanban Board. Include the link or the picture in the README file. - -The **deadline** to turn in the deliverables is right before the project presentations. - -## Mentoring -One of the TAs will be your mentor! - -Your mentor will: -* Keep track of your project in general terms. Your mentor will be the second person that knows more about the project, after you. -* Check if you are following your plan: are you keeping up with your tasks and deadlines? Do you have any obstacles blocking you? -* Help/support you with specific questions. - -Your mentor is **not** meant to: -* Know everything. -* Be your manager. You have to be responsible of your own tasks! - -## Schedule - -**Please note** that the following schedule is simply a guideline. Feel free to organize your work as you see fit. - -**Wednesday** -* Choose the game that you are going to code. -* Plan your project. Remember that we are providing you with a Trello [template](https://trello.com/b/pc2CNZTo/project-1-build-your-own-game). Remember that you **CAN'T CODE** until your project is planned. -* Fork the repository and edit the README overview. You can find a [template](https://github.com/ta-data-bcn/Project-Week-1-Build-Your-Own-Game/blob/master/your-project/README.md) for your README file in this repository. Remember to keep the README up-to-date. -* Once you finish, start coding! Remember to use functions. - -**Thursday** -* Finish the coding and possibly check for bugs in the program (e.g. check what happens if the player gives unexpected inputs to the program). -* In the evening, start preparing the slides for Friday's presentation. - -**Friday** -* Presentation time at **3PM**! There will be a 15-minute break during the presentations. - -## Presentation -You will have **3 minutes** to present your project to the class and then **2 minutes** for Q&A. - -The slides of your presentation must include the content listed below and a demo of your game: - -* Title of the project + Student name -* Description and rules of your game -* Workflow -* Challenges you encountered during the process -* Learnings -* Possible future improvements -* Demo of the game (remember to save time for it) - -Tip: you have only 3 minutes for this presentation so keep it simple! diff --git a/README.md b/README.md index 884c281..b9108c8 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,10 @@ The goal of the project is to build a simple console game ## Rules -Guess the secret number in the magician's hat. If your guess is higher or lower, you'll get a hint. +The FunBrain Magician will pick a secret number and put it in his hat. +You guess what number it is. +If your guess is too high or too low, FunBrain will give you a hint. +See how many turns it takes you to win! ## Workflow 1. Research about the game. @@ -26,6 +29,7 @@ Guess the secret number in the magician's hat. If your guess is higher or lower, 3. Code the game 4. Test it + 4.1. Handling some edge cases and errors 5. Prepare presentation diff --git a/your-project/README.md b/your-project/README.md deleted file mode 100644 index 2a8493d..0000000 --- a/your-project/README.md +++ /dev/null @@ -1,34 +0,0 @@ -Ironhack Logo - -# Title of Your Project -*[Your Name]* - -*[Your Cohort, Campus & Date]* - -## Content -- [Project Description](#project-description) -- [Rules](#rules) -- [Workflow](#workflow) -- [Organization](#organization) -- [Links](#links) - -## Project Description -Write a short description of your project. Write 1-2 sentences about the game you chose to build and why. - -## Rules -Briefly describe the rules of the game. - -## Workflow -Outline the workflow you used in your project. What are the steps you went through? - -## Organization -How did you organize your work? Did you use any tools like a kanban board? - -What does your repository look like? Explain your folder and file structure. - -## Links -Include links to your repository, slides and kanban board. Feel free to include any other links associated with your project. - -[Repository](https://github.com/) -[Slides](https://slides.com/) -[Trello](https://trello.com/en) From 5f2e082568b0cea2407419e3880dc99e6c136e1e Mon Sep 17 00:00:00 2001 From: Nikolov-A Date: Thu, 3 Jun 2021 20:27:11 +0200 Subject: [PATCH 4/5] 03/06/2021 --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b9108c8..e92e532 100644 --- a/README.md +++ b/README.md @@ -30,11 +30,11 @@ See how many turns it takes you to win! 4. Test it -4.1. Handling some edge cases and errors +5. Handling some edge cases and errors -5. Prepare presentation +6. Prepare presentation -6. Update github +7. Update github ## Organization From 58f847561ce1b8aa8d59d71838a4cbeeb4a67f46 Mon Sep 17 00:00:00 2001 From: Nikolov-A Date: Thu, 3 Jun 2021 20:36:42 +0200 Subject: [PATCH 5/5] 03/06/2021 --- your-project/guess_the_number.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/your-project/guess_the_number.py b/your-project/guess_the_number.py index 8f73d61..369bbe5 100644 --- a/your-project/guess_the_number.py +++ b/your-project/guess_the_number.py @@ -82,8 +82,6 @@ def pick_a_number_message(level): guess = None current_turn = 0 -print(magic_number) - while current_turn < turns and not guess == magic_number: try: guess = int(input(f'{message}'))