private void Update() { if (levelActive && currentLevel.InEquilibrium()) { levelActive = false; onLevelWin?.Invoke(currentLevel); } }
static bool Depthsearch(Matchspace space, Stack <SwapPair> path) { foreach (SwapPair step in PossibleSwaps(space)) { step.Swap(); space.Step(); path.Push(step); if (space.IsSolvable() && Depthsearch(space, path)) { break; } else { path.Pop().Swap(); space.Step(); } } return(space.InEquilibrium()); }