Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
6 changes: 6 additions & 0 deletions .gitgnore.rtf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{\rtf1\ansi\ansicpg1252\cocoartf2513
\cocoatextscaling0\cocoaplatform0{\fonttbl}
{\colortbl;\red255\green255\blue255;}
{\*\expandedcolortbl;;}
\paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0
}
155 changes: 155 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
# Created by https://www.toptal.com/developers/gitignore/api/jupyternotebooks,python
# Edit at https://www.toptal.com/developers/gitignore?templates=jupyternotebooks,python

### JupyterNotebooks ###
# gitignore template for Jupyter Notebooks
# website: http://jupyter.org/

.ipynb_checkpoints
*/.ipynb_checkpoints/*

# IPython
profile_default/
ipython_config.py

# Remove previous ipynb_checkpoints
# git rm -r .ipynb_checkpoints/

### 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/
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

# IPython

# 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

# 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
.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/

# profiling data
.prof

# End of https://www.toptal.com/developers/gitignore/api/jupyternotebooks,python
6 changes: 6 additions & 0 deletions .gitignore.rtf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{\rtf1\ansi\ansicpg1252\cocoartf2513
\cocoatextscaling0\cocoaplatform0{\fonttbl}
{\colortbl;\red255\green255\blue255;}
{\*\expandedcolortbl;;}
\paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0
}
134 changes: 134 additions & 0 deletions your-project/Guess Magician's number.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# GUESS THE MAGICIAN'S NUMBER"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### A magician has come to Ironhack and want to challenge people if they are luckily enough to guess the number he takes out of his hat. Do you think you will guess it correctly?\n",
"\n",
"### Give it a try!"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import random\n",
"import time"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"player_name = input(\"Let's play GUESS THE NUMBER GAME, enter your name: \")\n",
"print(\"Nice to meet you\",player_name,\"!\" )\n",
"time.sleep(3)\n",
"print(\"I'll take a number out of the hat between 1 and 30\")\n",
"time.sleep(4)\n",
"print(\"↓↓ If you guess it correctly ↓↓\") \n",
"time.sleep(2)\n",
"print (\"\")\n",
"print (\" Y O U W I N !!!\")\n",
"time.sleep(2) \n",
"print (\"\")\n",
"print(\"↓↓ If you fail to guess 5 times ↓↓\") \n",
"time.sleep(2) \n",
"print (\"\")\n",
"print (\" Y O U L O S E ;( !!!\")\n",
"print (\"\")\n",
"time.sleep(2)\n",
"print(\">>>>> YOU HAVE 5 ATTEMPTS to guess ✅ <<<<< \")\n",
"time.sleep(3)\n",
"print (\"\")\n",
"print(\" Easy peasy, so let's get started! 🧙‍♂️\")\n",
"time.sleep(4)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"magician_choice = random.randint(1,30)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"player_choice = int(input(\"Guess the number between 1 and 30: \"))\n",
"time.sleep(2)\n",
"\n",
"rounds_played = 1\n",
"\n",
"while player_choice != magician_choice and rounds_played < 5:\n",
" if player_choice < magician_choice:\n",
" print (\"You have to choose a higher number, try again!\")\n",
" else:\n",
" print (\"You have to choose a lower number, try again!\")\n",
" \n",
" player_choice = int(input(\"Incorrect!, try again: \"))\n",
" time.sleep(2)\n",
" rounds_played +=1\n",
" \n",
"\n",
"if player_choice == magician_choice and rounds_played <= 5:\n",
" time.sleep(2)\n",
" print(\"\")\n",
" print (\"You win!!! CONGRATS 🏆🎉🎉 the correct number was\", magician_choice)\n",
" \n",
"\n",
"while player_choice != magician_choice and rounds_played >= 5:\n",
" print (\"You run out of attempts 😭 >>> YOU LOST! The correct number was: \", magician_choice)\n",
" print(\"\")\n",
" print(\"Game is finished, thank you for playing! 😃\")\n",
" time.sleep(2)\n",
" break\n",
" "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
37 changes: 25 additions & 12 deletions your-project/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<img src="https://bit.ly/2VnXWr2" alt="Ironhack Logo" width="100"/>

# Title of Your Project
*[Your Name]*
# Guess the magician's number
*Sergio Monge Aguilar*

*[Your Cohort, Campus & Date]*
*Bootcamp Data Analytics Barcelona OCT20*

## Content
- [Project Description](#project-description)
Expand All @@ -13,22 +13,35 @@
- [Links](#links)

## Project Description
Write a short description of your project. Write 1-2 sentences about the game you chose to build and why.
It is an alternative version of the Guess a number game. There are a magician who randomly takes a number out of his hat and the player who tries to guess the number.


## Rules
Briefly describe the rules of the game.
The magician takes a randomly number out of his hat between 1 and 30. Later, the magician asks the player to guess that number in a maximum of 5 attempts.

For each attempt failed, the magician gives a hint on whether the number to guess is lower or higher than the number guessed on the previous attempt.

If the player can make it in less than 5 tries wins the game. Otherwise, he loses.


## Workflow
Outline the workflow you used in your project. What are the steps you went through?
1. First of all, defining out the tasks to do via Trello.

2. Then I started to set the rules of the game and think how to go through out of the code.

3. Afterwards, I have been aplying these rules and translating them into coding. Starting by defining a random function for the magician and an input function for the player, as giving some conditionals for each possible scenario regarding on player's answer.

4. Finally, trying to automatise the game by importing 'sleep' function from 'time' module so the game could go as smooth as possible.


## Organization
How did you organize your work? Did you use any tools like a kanban board?
I used Trello board to set the tasks and then like old-school, writing down to process to go through in a notebook with the main ideas I went encoutering and how I wanted the game to be. It really helped me to write these lines and later adapting them when passing from just written notes to real code.

What does your repository look like? Explain your folder and file structure.
Regarding to the repository structure, it is divided on a folder where we can find embedded on it this Readme file and the code notebook of the game itself and the .gitignore text file.

## Links
Include links to your repository, slides and kanban board. Feel free to include any other links associated with your project.
Following I am attaching the links I used to work on this first project.

[Repository](https://github.com/)
[Slides](https://slides.com/)
[Trello](https://trello.com/en)
[Repository] https://github.com/segis23/Project-Week-1-Build-Your-Own-Game
[Slides] https://docs.google.com/presentation/d/1AvGdAJKhZBiVqf113-1dghuKTJK5jT9divU_zXlWiBU/edit?usp=sharing
[Trello] https://trello.com/b/oNPCV30O/project-1-guess-the-number-sergio-monge