private void countSolution() { while (priorityInOperations.Count != 0) { Cub c = priorityInOperations.pop(); Point3D start = c.findFreePlace(); Console.Out.WriteLine("{0} {1} {2} {3} {4} - {5}", c.filledLayers[0], c.filledLayers[1], c.filledLayers[2], c.filledLayers[3], c.filledLayers[4], priorityInOperations.Count); if (c.isGathered()) { solution = c; printSolution(); return; } foreach (var fun in Pentamino.functions) { Tuple <bool, Point3D[]> res = fun(start, c); if (res.Item1) { Cub cp = c.copy(); cp.setPoints(res.Item2); priorityInOperations.push(cp); } } } }
public Cub pop() { Cub c = top(); cubs.RemoveAt(0); return(c); }
public Solution(int p_size) { pentaminoes = Enumerable.Repeat(-1, p_size * p_size).Select((_, i) => new Pentamino(i + 1)).ToList(); cub = new Cub(p_size); solution = new Cub(p_size); this.p_size = p_size; priorityInOperations.push(cub); }
// Start is called before the first frame update void Awake() { this.winScreen = GameObject.Find("WinScreen"); this.loseScreen = GameObject.Find("LoseScreen"); this.introCanvas = GameObject.Find("IntroCanvas"); this.winScreen.SetActive(false); this.loseScreen.SetActive(false); this.cub = GameObject.Find("Cub").GetComponent <Cub>(); this.floorSpawner = GameObject.Find("FloorSpawner").GetComponent <FloorSpawner>(); this.player = GameObject.Find("Player").GetComponent <PlayerController>(); this.pointSpawner = GameObject.Find("PointSpawner").GetComponent <PointSpawner>(); this.camera = GameObject.Find("Main Camera").GetComponent <Camera>(); this.gameOverSound = GameObject.Find("game_over"); this.gameWonSound = GameObject.Find("game_won"); this.backgroundMusic = GameObject.Find("Audio Source"); }
public void push(Cub c) { int cnt = 0; foreach (var cs in cubs) { if (c.CompareTo(cs) > 0) { cubs.Insert(cnt, c); break; } else { ++cnt; } } cubs.Add(c); }