Skip to content

latorreandrea/Besige-

Repository files navigation

BESIGE

Code Institute Portfolio 3 Project

schermata iniziale

BESIGE is a Python terminal game, where the user lead an attak to a castle

A live version of the game can be found here

table of content:

How to play:

Scope

In this game you will lead the attack of a siege at the beginning of the game over the name and difficulty of the siege you can choose how to compose your army and how to approach the siege "day by day" via input.

The aim of the game is to conquer the castle by force or to conquer it by wasting away.

You win when all the walls of the castle are conquered or when the defending garrison runs out of food.

vincere

Attention! you could run out of food or men in that case you lose the game!

perdere per mancanza di cibo

Set Army

Your army can have the maximum size of 200 points. and you will start whit only 300 unit of food

the troops you can choose are two types:

  • spy : their value is 10 points
  • scout : their value is 5 points

the remaining points will be converted into regular soldiers:

  • regular soldiers : their value is 1 point

200 point = soldiers + spy x 10point + scout x 5point

controllo scelta armata

In the meantime the computer will have an army composed of a variable number of troops ranging from 50 to 100 soldiers. The defenders were ready and have amassed 1000 units in their food supplies.

Maintaining Unit:

At the end of each turn you will consume an amount of food equal to the size of your army.

Don't make it too big that you eat too much food quickly and not too small that you can't attack the walls.

perdere per mancanza di cibo

Spy:

spy can tell to the user how many men defend the castle. if the user is lucky he may be able to sabotage the computer's food supply. Sabotage is related to the number of spies in the army!

Attention spying is a risky action and you could risk losing a spy in action.

perdere una spia

If you run out of spies, you will no longer be able to spy on your opponent

Scout:

The scouts allow to forages at cost of one day of siege can give from 10 to 50 unit of food per scout

but remember you could be attacked in a defender sortie!

Regular soldier:

They are the meat of the slaughter, they number in the army, and as long as you have an army you can storm the castle Attacking will allow you to try to conquer the walls by losing men. but in the end you can get an estimate based on the men lost on how big the enemy army is:

attacco e poi scelta

If the defenders are more than 90, you will lose 25% of your army

If the defenders are more than 80, you will lose 20% of your army

If the defenders are more than 60, you will lose 15% of your army

If the defenders are more than 30, you will lose 10% of your army

If the defenders are less than 30, you will lose 5% of your army

Features:

Existing Features:

  • Player select his army:

scelta esercito

  • The player is forced to use spies to get information on the enemy:

spionaggioriuscito

  • Required player name and game difficulty:

scegli nome

  • Inform the player of how many resources he has at the end of the turn and allow him to act accordingly:

foraggiare e poi scelta

  • Input validation and and request of last input:

controllo input controllo scelta armata

Future Features:

  • Implement functions that make the computer more aggressive
  • Make the game actually more balanced
  • Add other elements of randomness eg. the beginning of illnesses and the arrival of reinforcements for the besieged
  • Add an analyze function for defenders

Data Model:

Siedge Game in python!

The game is divided into two main phases:

  • Preparation phase (where the player and the pc choose which data to start with)
  • Game stage (the loop phase that will repeat until the attackers run out of units or food or when the defenders run out of food or the attackers conquer the walls)

Technologies Used

  • Python

    • used to write the code.
  • Lucidchart

    • used to plan the operation of the code.
  • PEP8Online

    • used to check the code for PEP8 requirements.
  • GitHub

    • used to store the source code and repository.
  • Heroku

    • used to deploy my code.

Testing:

Fixed Bugs

  • I used PEP8 online to check code for PEP8 requirements. Bugs in writing the code were inherent in the unintentional creation of blanks. Still impossible to remove this error results at the end of the code but this does not affect the functioning of the code

  • Input for scout and spy: if i put casual strings the game stop to work so i had to create a function to control if the user use numbers instead strings

  • The loop phase dont play as i aspected so i create a alive variable to check the loop phase and stop it properly.

  • The analysis function does not always seem to correctly calculate the days in which the player chooses to forage the problem was given by the fact that if not modified the data of the size of the armies was not "collected" so I added the append function to all the functions that did not foresee the change of the size of the army

Deployment

This project was deployed using Heroku.

  1. Fork or clone this repository

  2. Create a new Heroku app

  3. Set the buildbacks to Python and NodeJS in that order

  4. Link the Heroku app to repository

  5. Click on Deploy

Credit

I thank my tutor Marcel who, as usual, gave me excellent practical indications and pushes me to find more elegant solutions in drafting the code.

A special thanks to the beers with friends that allow you to have some nice ideas.

Thank you for taking the time to read my project.

About

Portfolio Project 3 Python Essentials

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published