Is Magic: The Gathering a consistent game? That is, is there any possible situation where the rules contradict on what to do next, and also, can a game hypothetically go on indefinitely?
The game can never end up in an undefined state.
There are rules for every situation, and they don't contradict each other. It is possible for the game to go into an infinite loop because of card/rule interactions, but the players have to either break the loop by doing something else, or the game ends in a draw, depending on the exact circumstances. In competitive settings such as a tournament (from world championships down to local prerelease events), there are also official judges present who can resolve any rules dispute.
I can't think of any rules that directly contradict one another. That said, there are known holes found and fixed with almost every rules update.
Do the rules cover everything?
The comprehensive rules cover most situations, and they also cover what to do when a conflict occurs. Here is an example of one of them:
101.1. Whenever a card’s text directly contradicts these rules, the card takes precedence
That said, the rules have holes. Here's a quote from Matt Tabak (rules manager for Magic: the Gathering) in the rules update for Dragons of Tarkir:
It wasn't clear what happened if an effect ended the turn during a cleanup step, so a clarification was made. In this unlikely occurrence, a new cleanup step begins. Essentially, you can't escape a turn without going through a "clean" cleanup step.
As you can see, the comprehensive rules have flaws, and these flaws are found and fixed with every rules update. These days, the majority of rules flaws will almost never be relevant in a real game.
Now forget about "honest, casual players. Regrettably, Magic has cheaters. If you, the reader, are a casual player who never plays in tournaments, you can skip this section on tournament rules and move on to the second question. The tournament rules do not apply to casual games.
There are tournament rules that require a judge to make a decision. If you get a different judge, you might get a different decision.
For example, if a judge believes that you are unintentionally breaking the rules, you might get a warning for failing to maintain the game state. However, if the judge believe you broke the rules intentionally, you will be disqualified. A different judge may reach a different conclusion.
Cheating will often appear on the surface as a Game Play Error or Tournament Error, and must be investigated by the judge to make a determination of intent and awareness.
Can a game hypothetically go on indefinitely
Originally, I answered with a simple "No." Turns out, it depends.
In casual play, it is possible for you and a friend to indefinitely shuffle your graveyards back into your library repeatedly. You could do this, for example, with an Elixir of Immortality. Nothing in the comprehensive rules prevents this from continuing forever.
In tournament play, there are rules in place to prevent this. If you shuffle your graveyard into your library, gain 5 life, and then repeat, then you have entered into what is known as an "indefinite infinite loop" (the indefinite part comes from the fact that even though you are in a loop, you don't really know what's going to happen next at any point in the loop). The most prominent ruling made on a case like this is about a deck known as the Four Horsemen.
- Read about Four Horsemen from a tournament official's perspective
- Read about Four Horsemen from a player's perspective
Continuing to execute any loop without specifying a number of times that you will repeat the loop is considered slow play (if you don't know it's against the rules) or stalling (if you do know it's against the rules). You will eventually be removed from the tournament for this behavior.
is there any possible situation where the rules contradict on what to do next
No. That said, sometimes that rules are unclear or they don't cover a certain circumstances, and sometimes judges will issue incorrect and contradictory rulings. But in large, the rules are quite well written, especially given the complexity of the possible interactions.
can a game hypothetically go on indefinitely?
Yes. It's possible to get into a situation where neither of the players can harm the other. These games typically end when one of the players runs out of cards to draw. But if both players had means to shuffle their graveyard into their library, such a game could have no end short of having a player conceded or having both players declare a draw. In a tournament setting, such games would end in a draw after the time available to play the game expires.
It is possible for a game to get into a state where it's impossible to tell whether the game is in an infinite loop or not :)
It's not very easy. But it's possible.
You need to set up the game state to be executing the Magic Universal Turing Machine. Program the Turing machine to calculate one of the great unsolved problems in mathematics, perhaps to ask whether there are any odd perfect numbers and halt the machine if it finds any. This game can therefore only end if there does exist an odd perfect number (which will have to be at least 10^1500).
It's clearest if you get the game running the version that uses Omen Machine so that all players have no choice whatsoever about their actions (not even any "may" abilities). But the version on that website will do, because the only player with "may" abilities is Alex and he's the player who stands to win if the calculation ever finishes.
A judge can accuse a player of stalling if they're just taking an indefinite infinite loop. But in this case Alex could win the game if the computation (the huge array of Yeti and Zombie tokens) ever discovers a number with the particular set of characteristics you've programmed the machine to look for...