Zombie Survivor

Level: Advanced 60–90 min

Concepts: StateBusiness LogicIncremental DesignEdge Cases


Model survivors in a zombie apocalypse boardgame. This kata is structured in six steps — each step adds new rules on top of the previous ones. Resist the urge to read ahead.

Step 1: Survivors

  • Each survivor has a name
  • Survivors start with 0 wounds
  • A survivor dies upon receiving their 2nd wound
  • Additional wounds to a dead survivor are ignored
  • Survivors begin with 3 actions per turn

Step 2: Equipment

  • Survivors can carry up to 5 pieces of equipment
  • Up to 2 pieces can be held “In Hand” — the rest go “In Reserve”
  • Each wound reduces carrying capacity by 1
  • When capacity decreases, excess equipment must be discarded (player’s choice)
WoundsMax EquipmentIn HandIn Reserve
0523
1422
2Dead

Step 3: The Game

  • A game begins with 0 survivors
  • Survivors can be added at any time
  • Survivor names must be unique within a game
  • The game ends when all survivors are dead

Step 4: Experience and Levels

  • Survivors earn 1 experience point per zombie killed
  • Four levels based on cumulative XP:
LevelXP RequiredColor
Blue0Starting level
Yellow7+
Orange19+
Red43+
  • The game level equals the highest level among living survivors

Step 5: Game History

The game tracks a history log of all events:

  • Game started (with timestamp)
  • Survivor added
  • Equipment acquired
  • Wound received
  • Survivor died
  • Level up
  • Game level changed
  • Game ended

Step 6: Skills

Each survivor has a skill tree that unlocks as they level:

LevelSkills Unlocked
Yellow1 skill: +1 Action (mandatory first skill)
OrangeChoose 1 of 2 available skills
RedChoose 1 of 3 available skills

Available skills:

  • +1 Action — gain an additional action per turn
  • Hoard — increase equipment capacity by 1
  • Sniper — (flavor skill, no mechanical effect for this kata)
  • Tough — (flavor skill, no mechanical effect for this kata)

After reaching 43+ XP, survivors restart their skill tree and can unlock additional skills at subsequent level thresholds. Maximum three complete cycles.

Test Cases

ScenarioExpected
New survivor0 wounds, 3 actions, alive
Receive 1 wound1 wound, still alive, capacity 4
Receive 2nd woundDead
Wound a dead survivorNo change
Equip 6 itemsError: max 5
1 wound with 5 itemsMust discard 1
Duplicate survivor nameError: name taken
Kill 7 zombiesLevel up to Yellow, gain +1 Action
All survivors deadGame ends
Game levelMatches highest living survivor

Hint

Follow the steps in order. Each step is self-contained — get it fully working and tested before moving to the next. Step 1 is trivially simple on purpose. The discipline of testing even obvious things is the point.