Esempio n. 1
0
 private void Update()
 {
     if (levelActive && currentLevel.InEquilibrium())
     {
         levelActive = false;
         onLevelWin?.Invoke(currentLevel);
     }
 }
Esempio n. 2
0
 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());
 }