Examples of QueenAction


Examples of aima.core.environment.nqueens.QueenAction

      String atype;
      if (env.getBoard().queenExistsAt(loc))
        atype = QueenAction.REMOVE_QUEEN;
      else
        atype = QueenAction.PLACE_QUEEN;
      env.executeAction(null, new QueenAction(atype, loc));
      agent = null;
      frame.updateEnabledState();
    }
View Full Code Here

Examples of aima.core.environment.nqueens.QueenAction

     * Executes the provided action and returns null.
     */
    @Override
    public EnvironmentState executeAction(Agent agent, Action action) {
      if (action instanceof QueenAction) {
        QueenAction act = (QueenAction) action;
        XYLocation loc = new XYLocation(act.getX(), act.getY());
        if (act.getName() == QueenAction.PLACE_QUEEN)
          board.addQueenAt(loc);
        else if (act.getName() == QueenAction.REMOVE_QUEEN)
          board.removeQueenFrom(loc);
        else if (act.getName() == QueenAction.MOVE_QUEEN)
          board.moveQueenTo(loc);
        if (agent == null)
          updateEnvironmentViewsAgentActed(agent, action, null);
      }
      return null;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.