private void Reset() { Generator.Finish(); Solver.Finish(); FinishedWithPhase = false; Phase = Phases.Generating; Looping = true; Auto = false; Maze.Reset(); ResetTileMap(); Generator.Start(); }
/* At each step, all CurrentMinions spawn new Minions in all the open spots adjacent to them. * These new RecruitMinions then replace the CurrentMinions, and CurrentMinions become Cells * All cells also update their color pattern to reflect distance traveled. */ private void StepWithMinions() { foreach (BFSminion m in this.CurrentMinions) { foreach (Location l in m.masterAct()) { this.addMinion(l); } Location minionLoc = m.Location; BFScell bCell = new BFScell(Grid, minionLoc, this); Cells.Add(bCell); } foreach (BFScell b in Cells) { b.UpdateColors(); } this.killMinions(); this.Steps++; if (this.CurrentMinions.Count() == 0) { if (!(Grid.Get(Target) is BFSminion || Grid.Get(Target) is BFScell)) { Grid.Reset(); CurrentMinions.Clear(); RecruitMinions.Clear(); Cells.Clear(); Phase = 1; Steps = 0; return; } this.Phase++; Grid.Remove(Location); MoveTo(Target); } }