/Factions

The Battle of the Factions

Factions

The Battle of the Factions

Problem:

5 factions go to battle and have to fight each other. Each faction has 20 units. Each fight occurs between 2 units of different factions. A faction cannot fight again until all other factions have fought at least as many times as it has. Within these constraints,factions should be chosen at random for fights. Units should also be chosen at random for fights. The winner of each fight should be chosen at random. The loser of a fight should die and cannot fight again. The fighting stops when no more battles can be fought. The winner is the last faction standing.

Program Output:

  • Report (write to log/console/UI) for each fight.
  • Which units and factions fought each other (and the winner)
  • Report the winning faction.

Deliverable: An Xcode project that contains the source, assets and any input data the candidate used. The project should be fully functional and should produce the output defined in the problem statement.