private void Awake() { messageController = messageUI.GetComponent <MessageController>(); actionNavigationController = actionNavigator.GetComponent <ActionNavigationController>(); padLockUIController = padLockUI.GetComponent <PadLockUIController>(); choiceUIController = choiceUI.GetComponent <ChoiceUIController>(); passwordController = passwordUI.GetComponent <PasswordController>(); riddleUIController = riddleUI.GetComponent <RiddleUIController>(); countDownUIController = countDownUI.GetComponent <CountDownUIController>(); eightPuzzle = eightPuzzleObj.GetComponent <EightPuzzle>(); enemyEnterProcess = GetComponent <EnemyEnterRoomProcess>(); edit = GetComponent <Edit>(); currentHasItemText = currentHasItemTextObj.GetComponent <Text>(); if (eightPuzzleUI.activeSelf) { eightPuzzleUI.SetActive(false); } if (editUI) { editUI.SetActive(false); } roomCMonitor = roomCMonitorObj.GetComponent <AirConMonitor>(); entranceRoomMonitor = entranceRoomMonitorObj.GetComponent <AirConMonitor>(); bookShelfController = bookShelf.GetComponent <BookShelfController>(); padLockCamera.SetActive(false); playerUI.SetActive(false); audioSource = GetComponent <AudioSource>(); }
// Done! private static void HeuristicHelper(string current, string goal, int value) { EightPuzzle pCurrent = EightPuzzleFactory.Create(current); EightPuzzle pGoal = EightPuzzleFactory.Create(goal); int h = pCurrent.GetHeuristic(pCurrent, pGoal); Assert.AreEqual(value, h); }
public void TesteMedio() { // teste 2 EightPuzzle ComputerAgent = new EightPuzzle(new int[] { 1, 2, 5, 7, 0, 4, 3, 6, 8 }, new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 }); int[] sol = ComputerAgent.GetSolution(); Assert.AreEqual(true, resolveProblem(new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 }, new int[] { 1, 2, 5, 7, 0, 4, 3, 6, 8 }, sol)); }
public void TesteFacinho() { // teste 1 EightPuzzle ComputerAgent = new EightPuzzle(new int[] { 1, 0, 2, 3, 4, 5, 6, 7, 8 }, new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 }); int[] sol = ComputerAgent.GetSolution(); Assert.AreEqual(true, CompareVector(new int[] { 1 }, sol)); }
static void Main() { Console.WriteLine("Type Start and End States. (One per line)"); string startState = Console.ReadLine(); string closeState = Console.ReadLine(); if (string.IsNullOrWhiteSpace(startState) || startState.Trim().Length != 9) { startState = "012345678"; Console.WriteLine("Assuming StartState as: {0}", startState); } if (string.IsNullOrWhiteSpace(closeState) || closeState.Trim().Length != 9) { closeState = "087654321"; Console.WriteLine("Assuming StartState as: {0}", closeState); } IStateSearchable <EightPuzzle> stateSearch; try { EightPuzzle start = EightPuzzleFactory.Create(startState); EightPuzzle close = EightPuzzleFactory.Create(closeState); stateSearch = new AStar <EightPuzzle>(start, close); stateSearch.FindPath(); if (stateSearch.HasSolution == false) { Console.WriteLine("No solution Found"); Console.ReadKey(); return; } } catch { Console.WriteLine("Was not possible to solve the puzzle!"); Console.ReadKey(); return; } AnimateSolutions(stateSearch); Console.WriteLine("Cost: " + stateSearch.MinimumCost); Console.ReadKey(); }
// Done! private static void MovesHelper(string parent, ICollection <string> childreen) { EightPuzzle pParent = EightPuzzleFactory.Create(parent); IList <EightPuzzle> pChildreen = pParent.Children(); Assert.AreEqual(childreen.Count, pChildreen.Count); var q1 = from x in pChildreen orderby x.ToString() select x; var q2 = (from x in childreen orderby x select x).ToList(); int i = 0; foreach (var item in q1) { Assert.AreEqual(q2[i++], item.ToString()); } }