OpenAI

Verified interview challenge

Build a turn-based monster battle simulator

Keep a battle simulation correct as damage rules and attacker selection become more complex.

Unlock with Full Access

The challenge

Start with a basic turn-based battle between two teams, then extend the same classes and battle function. Later parts add elemental types and a rule for choosing the best attacker. The exercise asks you to preserve event order and evolving team state while accommodating the new mechanics.

What you'll practise

  • Simulation ordering

    Keep attacks and state transitions consistent throughout a battle.

  • Extensible mechanics

    Add damage and selection rules without breaking earlier behaviour.

Your coding workspacePreview
Current partFurther parts unlock as you progress
solution.pyPython 3.13
# Build on your implementation

# Run checks for the current part

# Full starter code included
Current-part checks

Run your code to see results.

The complete sequence, starter code and checks are included with Full Access.