AIMA.Core.Environment.EightPuzzle.EightPuzzleFunctionFactory.EPActionsFunction.actions C# (CSharp) Method

actions() public method

public actions ( Object state ) : HashSet
state Object
return HashSet
            public HashSet<Action> actions(Object state)
            {
                EightPuzzleBoard board = (EightPuzzleBoard)state;

                HashSet<Action> actions = new LinkedHashSet<Action>();

                if (board.canMoveGap(EightPuzzleBoard.UP))
                {
                    actions.Add(EightPuzzleBoard.UP);
                }
                if (board.canMoveGap(EightPuzzleBoard.DOWN))
                {
                    actions.Add(EightPuzzleBoard.DOWN);
                }
                if (board.canMoveGap(EightPuzzleBoard.LEFT))
                {
                    actions.Add(EightPuzzleBoard.LEFT);
                }
                if (board.canMoveGap(EightPuzzleBoard.RIGHT))
                {
                    actions.Add(EightPuzzleBoard.RIGHT);
                }

                return actions;
            }
        }
EightPuzzleFunctionFactory.EPActionsFunction