The Battle of 2 Armies Simulator
A requirement to run this project inside of docker is, obviously, docker-compose
& docker
locally configured.
Start (and pull/build) containers:
docker-compose up -d
Install composer packages
bin/composer install
App is up and ready to be used at http://localhost:8080
.
Route definitions can be found inside of app/routes.php
.
There is GET /battle
route with parameters army1
and army2
which is used as battle simulator and it shows result
of battle with list of events that occurred during battle.
Other route GET /
is just "homepage" with title of project.
Battle is simulated through src/BattleSimulation/Battle.php
with all possible events that can happen on battle
created as implementation of src/BattleSimulation/Event/BattleEvent.php
.
Battle is fully random through \Armeerenko\BattleSimulation\BattleSimulator::simulate()
where a few events may happen:
- Army1 attacks Army2 (attack can be successful or failed),
- Army2 attacks Army1 (attack can be successful or failed),
- Random explosion that can hurt one or both armies.
There is simple "framework" created for this application/project that simplifies routing.
There is no env variables/configuration implemented, just docker containers for web and php-fpm. There are few helper
scripts available inside of bin/
directory to simplify development.