To any advanced player of Magic: The Gathering who is also a programmer:
If you have ever read through the comprehensive rules, it seems almost like the game was designed with a specific programming strategy in mind. The most obvious example is the use of "the stack" in the game behaving exactly like the data structure called a stack, but it goes well beyond that.
As an exercise to improve my logical aptitude as it applies to programming, I often think about how I would implement software that allows users to play Magic: The Gathering. The software would implement all game rules as they appear in the comprehensive rules document (You can download it from their website).
Most of the game rules fit perfectly into common programming styles; for example, triggered abilities could be implemented using Events. I consistently run into a problem, however, when I get to implementing a certain feature of abilities: Where does the ability function? Rules 112.6d-i are where I'm currently getting stuck. I can't seem to think of a general solution that doesn't rely on writing code specific to certain cards.
Please note that I currently have no intention to actually implement any type of Magic: The Gathering software. It is purely a thought exercise. My intention in asking here is to merely to entertain.
Edit: I apologize for the confusion with the rule number. I was using the April version of the file. I am interested in rules 112.5c through 112.5j
