aima.core.environment.vacuum.VacuumWorldActions Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aima-core Show documentation
Show all versions of aima-core Show documentation
AIMA-Java Core Algorithms from the book Artificial Intelligence a Modern Approach 3rd Ed.
The newest version!
package aima.core.environment.vacuum;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import aima.core.agent.Action;
import aima.core.search.framework.problem.ActionsFunction;
/**
* Specifies the actions available to the agent at state s
*
* @author Andrew Brown
*/
public class VacuumWorldActions implements ActionsFunction {
private static final Set _actions;
static {
Set actions = new HashSet();
actions.add(VacuumEnvironment.ACTION_SUCK);
actions.add(VacuumEnvironment.ACTION_MOVE_LEFT);
actions.add(VacuumEnvironment.ACTION_MOVE_RIGHT);
// Ensure cannot be modified.
_actions = Collections.unmodifiableSet(actions);
}
/**
* Returns possible actions given this state
*
* @param s
* @return possible actions given this state.
*/
@Override
public Set actions(Object s) {
return _actions;
}
}