D&D 5e Rules Engine

Pure Python rules engine covering dice, abilities, skills, combat, spellcasting, and character creation.

Built the foundational rules engine — a pure Python library with zero AI dependencies. Fully deterministic given fixed random seeds. This is the bedrock everything else sits on.

The engine covers:

  • Dice — rolling with advantage/disadvantage, rerolls, modifiers
  • Ability scores and modifiers for all six stats
  • Skill checks and saving throws with proficiency
  • Initiative and turn order
  • Attacks and damage — melee, ranged, with critical hits
  • Action economy — action, bonus action, reaction, movement, free interaction
  • All 15 SRD conditions plus exhaustion levels
  • Death saving throws with every edge case
  • Movement and opportunity attacks
  • Spellcasting — slot management, concentration tracking, spell effects
  • Character creation — 9 SRD races, 4 classes (Fighter, Rogue, Cleric, Wizard)
  • Encounter building and difficulty calculation

Built on SRD 5.1 (CC-BY-4.0). 18 known edge cases that AI DMs always get wrong are explicitly handled and tested — things like how grapple interacts with prone, or what happens when you heal an unconscious creature that has failed death saves.