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
19 changes: 19 additions & 0 deletions your-project/.gitignore.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

# Created by https://www.toptal.com/developers/gitignore/api/jupyternotebooks
# Edit at https://www.toptal.com/developers/gitignore?templates=jupyternotebooks

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

# End of https://www.toptal.com/developers/gitignore/api/jupyternotebooks
44 changes: 32 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]*
# Project Week 1 - Build your own game! Soldier & Dice (RISK)
*[Jose Miguel Martinez Montero]*

*[Your Cohort, Campus & Date]*
*[DAFT MAR21]*

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

## Project Description
Write a short description of your project. Write 1-2 sentences about the game you chose to build and why.

In this first project of the **Data Analytics Bootcamp** we will create a basic game software from scratch, applying the knowledge about *Python functions* we were learning during the first week.

I’ve chosen the game named **Soldier & Dice, as well known as Risk**, because this was my favourite board game since I was a child, and I thought It would be a beautiful challenge for me.

## Rules
Briefly describe the rules of the game.

Risk is a classic board game where two or more armies **will fight in order to dominate the whole world** reflected in the board by **continents and countries**.

**To fight** against the player who controls a territory beside yours, **you have to roll any number of dices according with the number of soldiers you have**in the attacking territory.

The defender player will roll some dices to defend, and then **the values between the biggest dices will be compared** in order to determine who is the winner and if the territory is conquered.


## Workflow
Outline the workflow you used in your project. What are the steps you went through?

First of all, I must **adapt the rules of the original game for more simplified ones**, ir order to code an usable software for this occasion.

I’ve started simplifying the experience of the game into the main basic feature of the game: fighting with dices.

Starting from a basic software of **generating random values for the dices**, the workflow was improving the game experience, including an input for the user, sophisticating the inner code and the visual result, and adding some funny different responses for every possible outcome.

The last step was **checking some bugs and errors** in the program.



## 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.
First of all, I’ve planned my work with a ***Kanban board** using the platform named Trello. There, you can plan every task of the project beforehand and set some deadlines for each one.

I’ve created this **GitHub repository**, including an updated Readme.md file and a .gitigonore file, well structured and functional.



## 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)
[Repository](https://github.com/JoseMtnz/Project-Week-1-Build-Your-Own-Game)
[Slides](https://docs.google.com/presentation/d/1isMlPjJKHorkVztUK9MTdQjGEe-mFsR4zONfv_lh8FU/edit?usp=sharing)
[Trello](https://trello.com/b/bRxbx5Ky/project-week-1-build-your-own-game)
232 changes: 232 additions & 0 deletions your-project/Soldier & Dice (Risk).ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Project Week 1 - Build your own game!"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Soldier & Dice (RISK)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"\n",
"Enter your number of soldiers for attacking or enter 'quit' if you want to surrend: \n",
"\n",
"\n",
"Please, introduce something I can understand if you want to play Risk with me!!\n",
"------------------------------\n",
"\n",
"\n"
]
}
],
"source": [
"import random\n",
"\n",
"\n",
"\n",
"playagain=True\n",
"\n",
"while (playagain==True):\n",
" \n",
" player=0\n",
" machine=0\n",
" \n",
" diceuser=[]\n",
" dicemachine=[]\n",
" \n",
" print(\"\\n\")\n",
" x=input(\"Enter your number of soldiers for attacking or enter 'quit' if you want to surrend:\") \n",
" \n",
" \n",
" if x.isdigit() == False: \n",
" \n",
" if x.lower() == \"quit\":\n",
" playagain==False\n",
" print(\"\\n\")\n",
" print(\"Thank you for playing! That's all for now, folks!\")\n",
" print(\"------------------------------\")\n",
" break\n",
" else:\n",
" print(\"\\n\")\n",
" print(\"Please, introduce something I can understand if you want to play Risk with me!!\")\n",
" print(\"------------------------------\")\n",
" \n",
" else:\n",
" \n",
" \n",
" x=int(x)\n",
" \n",
" if x == 0:\n",
" print(\"\\n\")\n",
" print(\"How are you going to attack me with 0 soldiers? LOL\")\n",
" print(\"------------------------------\")\n",
" \n",
" if x == 1:\n",
" print(\"\\n\")\n",
" print(\"One soldier is not enough to attack! Don't waste our time!\")\n",
" print(\"------------------------------\")\n",
" \n",
" \n",
" \n",
" if x == 2:\n",
" diceuser.append(random.randint(1,6)) \n",
" dicemachine.append(random.randint(1,6)) \n",
" dicemachine.append(random.randint(1,6))\n",
" print(\"\\n\")\n",
" print(\"This is the best value you got in your dice\",max(diceuser))\n",
" print(\"And I got the following points in my dices :\",dicemachine,\"being my best value:\",max(dicemachine))\n",
" if max(diceuser)>max(dicemachine):\n",
" player=player+1\n",
" if max(dicemachine)>=max(diceuser):\n",
" machine=machine+1\n",
" if player > machine:\n",
" print(\"\\n\")\n",
" print(\"You win the battle! Lucky you, my friend!\")\n",
" print(\"------------------------------\")\n",
" if machine >= player:\n",
" print(\"\\n\")\n",
" print(\"Sayonara, baby! But in life you can always try again ;)\")\n",
" print(\"------------------------------\")\n",
" \n",
" \n",
" \n",
" if x == 3:\n",
" diceuser.append(random.randint(1,6)) \n",
" diceuser.append(random.randint(1,6)) \n",
" dicemachine.append(random.randint(1,6)) \n",
" dicemachine.append(random.randint(1,6))\n",
" print(\"\\n\")\n",
" print(\"You rolled two dices :\",diceuser,\"and your best value on them is:\",max(diceuser))\n",
" print(\"And I got the following points in my dices :\",dicemachine,\"being the best value of them:\",max(dicemachine))\n",
" if max(diceuser)>max(dicemachine):\n",
" player=player+1\n",
" if max(dicemachine)>=max(diceuser):\n",
" machine=machine+1\n",
" if player > machine:\n",
" print(\"\\n\")\n",
" print(\"You win the battle! Well done!\")\n",
" print(\"------------------------------\")\n",
" if machine >= player:\n",
" print(\"\\n\")\n",
" print(\"You lose the battle! :P\")\n",
" print(\"------------------------------\")\n",
" \n",
" \n",
" if x > 3:\n",
" diceuser.append(random.randint(1,6)) \n",
" diceuser.append(random.randint(1,6))\n",
" diceuser.append(random.randint(1,6))\n",
" dicemachine.append(random.randint(1,6)) \n",
" dicemachine.append(random.randint(1,6))\n",
" print(\"\\n\")\n",
" print(\"These are your results of rolling three dices :\",diceuser,\"and your best value is:\",max(diceuser))\n",
" print(\"I've rolled two dices:\",dicemachine,\"being my best value between them:\",max(dicemachine))\n",
" if max(diceuser)>max(dicemachine):\n",
" player=player+1\n",
" if max(dicemachine)>=max(diceuser):\n",
" machine=machine+1\n",
" if player > machine:\n",
" print(\"\\n\")\n",
" print(\"You win the battle! Obviously, with three dices is easier!\")\n",
" print(\"------------------------------\")\n",
" if machine >= player:\n",
" print(\"\\n\")\n",
" print(\"Loser! It's better if you quit now!\")\n",
" print(\"------------------------------\")\n",
" \n",
" \n",
" \n",
"\n",
"\n",
"\n",
"\n",
"\n",
" "
]
},
{
"cell_type": "markdown",
"metadata": {},
"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"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": true
},
"varInspector": {
"cols": {
"lenName": 16,
"lenType": 16,
"lenVar": 40
},
"kernels_config": {
"python": {
"delete_cmd_postfix": "",
"delete_cmd_prefix": "del ",
"library": "var_list.py",
"varRefreshCmd": "print(var_dic_list())"
},
"r": {
"delete_cmd_postfix": ") ",
"delete_cmd_prefix": "rm(",
"library": "var_list.r",
"varRefreshCmd": "cat(var_dic_list()) "
}
},
"types_to_exclude": [
"module",
"function",
"builtin_function_or_method",
"instance",
"_Feature"
],
"window_display": false
}
},
"nbformat": 4,
"nbformat_minor": 4
}