This project is an interview step into Swingdev company. Task is to create two army war simulation with probability factor.
Idea is to create it using Akka Actors. Each soldier is represented by one Actor. Each army can consists of arbitrary amount of soldiers.
There are three types of soldiers:
- Archer
- Knight
- Horserider
Each type of soldier has its unique abilities. We assume that world where game takes place is arbitrary big array NxM each soldier occupies one square. They also have something like 'visibility range'. This range is represented by a number of squares it can spot enemies around him.
Actor can make two types of moves:
-
Move
If it wants to move it sends new desired location to WorldActor. World Actor validates decision. If new place on map is empty it sets soldier's location to it and sends back:
- Confirmation
- Position
- List of enemies in it's range together with their ActorRefs
- VectorClock
-
Attack
Soldier can attack only after verifying there are enemies in his visibility range. If there are it sends:
- Attack command
- VectorClock
sbt run
Neat!