public void ShuffleEigthPuzzleInitialState(AriciePropertyEditorControl ape) { var eightPuzzleBoard = new EightPuzzleBoard(EightPuzzleInitialState.ToArray()); var actionsFunction = EightPuzzleFunctionFactory.getActionsFunction(); var resultFunction = EightPuzzleFunctionFactory.getResultFunction(); var previousBoards = new HashSet <EightPuzzleBoard>(); for (int i = 0; i < EightPuzzleShuffleMoves; i++) { Object[] successors = actionsFunction.actions(eightPuzzleBoard).toArray(); EightPuzzleBoard nextState; do { var choosenSuccessorIdx = CryptoHelper.Random.Next(successors.Length); var objAction = (aima.core.agent.Action)successors[choosenSuccessorIdx]; nextState = (EightPuzzleBoard)resultFunction.result(eightPuzzleBoard, objAction); } while (previousBoards.Contains(nextState)); previousBoards.Add(eightPuzzleBoard); eightPuzzleBoard = (EightPuzzleBoard)nextState; } EightPuzzleInitialState = new List <int>(eightPuzzleBoard.getState()); ape.ItemChanged = true; }
public void InitEigthPuzzleInitialState(AriciePropertyEditorControl ape) { EightPuzzleInitialState = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 }.ToList(); ape.ItemChanged = true; //string message = Localization.GetString("ParametersCreated.Message", ape.LocalResourceFile); //ape.DisplayMessage(message, ModuleMessage.ModuleMessageType.GreenSuccess); }
public void Reset(AriciePropertyEditorControl ape) { reset(); ape.DisplayMessage("Counter was reset", ModuleMessage.ModuleMessageType.GreenSuccess); ape.ItemChanged = true; }