This code for make test simulation of war, this will help how ever who make a game and need to make war simulation in hes game, so this include
- create soldiers data with all status from random
- make attack as tern base
- sure death soldiers not attack or attaked
- on each attack 2 army will be shuffle so each soldier will face another enemy soldier each time
- soldiers have energy stat that decrease whin attak or taking damage
- energy will lower attack as formula = attack * (energy/100), so if soldier have 20 energy attack will lower to 20%
- soldiers have poor energy or poor health will not attack and rest to recover they energy and health by random
- soldiers that not attacked will take rest and rise energy and health by random
- if size of attacker and defencer are differents it will take off the excess amount from larger army to take rest so more army take advantage
and more
- add lucky, so in defencer more lucky add more miss chance, on attaker give more double damage chance.
and more
- in 10K of soldier on each army its take only 50 milliseconds from my laptop
- in 100K of soldier on each army its take 500 milliseconds from my laptop
- in 1M of soldier on each army its take 5 second from my laptop, this is amazing!!!
this project give as hope to make more simulations, like city economy or animal life or bots life or match more.
this project uploaded at github on this link
https://github.com/qahmad81/war_simulation
thanks for fountainhead on help to solve performance issues in this link https://stackoverflow.com/questions/64513436/in-python-with-numpy-how-can-i-update-array-from-another-array-depend-on-column