Infinite Loop

**Infinite Loop** is an event that prevents a level from proceeding, forcing the player to either undo or restart the level. It is usually caused by reaching a state where no coherent set of rules can be determined. Specifically, an infinite loop occurs in the following cases:

* Parsing takes more than 200 iterations (via ). This is possible in Broken, Ultimate Maze , and Forage.
* Conditions take more than 80 iterations (via ).
* Falling takes more than 6000 iterations.
* Group membership takes more than 400 iterations (e.g. ). This is possible in New Members.
* PUSHing and/or PULLing takes more than 10,000 iterations. This is not possible in most levels, even those in which you can freely duplicate objects (e.g. Baba Is You (level)), as you will Too Complex from reaching 2000 objects long before you can reach this limit, even when stacking objects.
* Any object with CRASH exists.

## Examples

In these examples, nouns can be replaced with any object.

* and  at the same time.
	+ It creates an infinite loop because first, the game processes , so it checks for rocks in the level to process them, and finds . This rule negates , so it rechecks all the conditions.  has changed, so it stops taking precedence over , so that condition gets applied again. After about 99 more repetitions of this, the game sees there have been more than 200 operations in the single move. Cue the infinite loop screen. This can be done in Broken.
* , replacing  with infix conditions like:  without the rule-forming object meeting the condition of the rule.
	+ It creates an infinite loop because first, the game processes , so it checks for rocks in the level to process them, and finds , which the original instruction was part of. The original instruction is disabled, taken precedence over by . Since there are no rocks nearby, rock is not a word. The game rechecks again, and once again sees . After about 99 more repetitions of this, the game sees there have been more than 200 operations in the single move. Cue the infinite loop screen. This can be done in Forage.
* , unless every object is already GROUP.
	+ It creates an infinite loop because an object that is not group, now becomes part of a group, thus not being a group anymore. This can be done in New Members.
* as long as there are objects present that belong to the GROUP.
	+ It creates an infinite loop because an object that is group is excluded from the group, but then is no longer excluded from the group. This can be done in New Members.
* when Baba is near every type of object belonging to GROUP but not near another Baba.
	+ It creates an infinite loop because when Baba is near every group object, Baba itself becomes part of a group. However, since there are no other Babas near Baba, Baba no longer meets the condition and is not part of the group anymore.
* combined with .
	+ It creates an infinite loop because  would disable , therefore disabling , enabling  again.
* Toggling "High-contrast colors" option on and off too many times. Eventually, this causes the music to stop and the game to go into "infinite loop" screen.
	+ It creates an infinite loop because toggling this setting re-parses rules in the level, and therefore contributes to the 200-iteration parsing limit.

## Trivia

* The Infinite Loop screen was implemented as a precaution for Custom Levels. However, shortly thereafter, it was determined that Broken was capable of forming an infinite loop.
* The Switch version, lagging behind the PC version for several months, did not receive this update until 1.0.5.
* If the player completes the stage on the same move as triggering an infinite loop, the "Congratulations!" message will appear on top of the Infinite Loop screen.
* It is not, strictly speaking, possible to programmatically detect all infinite loops without error—this is called the halting problem, and it was proven mathematically impossible in 1936. Thus, as detailed above, the game is technically detecting *implausibly lengthy* loops, and assuming that they are probably infinite.
* Creating any X  CRASH  CRASH rule will crash the game for real, as the game will go into an infinite loop trying to figure out whether to trigger the Infinite Loop screen. Interestingly, this crash is similar to the method by which the halting problem was proven impossible.
* In the event that Infinite Loop takes place at the same time as Too Complex, Too Complex takes priority.