squad
1#include "squad/TurnBasedCombat.h"
2
3//////////////////////////////////////////////////////////
4// Реализация понятий предметной области
5
6TurnBasedCombat::TurnBasedCombat(Scene & scene, View_interface & view)
7: _scene(scene)
8, _view(view)
9{
10}
11
12void TurnBasedCombat::fight(Rules_interface & rules)
13{
14_view.outputScene();
15
16while(!rules.isDone())
17{
18StepQueue_SW step_queue = rules.generateStepQueue();
19
20for(auto [squad_index, warrior_index] : step_queue) {
21_view.outputStep(squad_index, warrior_index);
22rules.produceStep(squad_index, warrior_index);
23}
24
25_view.outputScene();
26}
27
28size_t winner = rules.whoIsWin();
29
30_view.outputWinner(winner);
31}
32