dimanche 17 novembre 2019

python - problem with loop taking info from outside of loop

It is my first post here

Please see my code: https://repl.it/repls/UnevenLovingDecagons it is a game called Namiestnik which originally was on C64 and it was text economic strategy game, but I try to rewrite it with python - I am beginner so I do best I can ;-) It is my first "serious" project.

cololny_size has been specified once before loop. Then the loop changes colony_size few times and my idea is so after loop ends and replays colony_size from end of loop continues on beginning of run in next run. At the moment the loop with each run is influenced with "colony_size=(randrange(50,150))" all the time - how can I change it so "colony_size=(randrange(50,150))" influences the loop only for 1st run of loop?

also another question - I want to place in loop two random occurrences: 1st - disease that happens each few years, meaning half of colony will die. I know how to make it happen regulary, but I want it to happen each few years, like 2 years in a row, then after 5 years or 7 years and so on?

2nd- I want the character to die at some point (meaning game over) but it has to be random point of game, so once he can live 35 years till death, then he can die after 5 years or so.




Aucun commentaire:

Enregistrer un commentaire