That said, I would pay good money to look at the source code of some of the production MTG rule systems.
https://mtg.fandom.com/wiki/Layer
https://media.wizards.com/2026/downloads/MagicCompRules%2020...