Package maze.model

Examples of maze.model.RobotModelMaster$RobotCrashedException


   public RobotController(MazeModel model, RobotBase robotAI)
   {
      this.mazeModel = model;
      this.ai = robotAI;
      final MazeCell start = MazeCell.valueOf(1, this.mazeModel.getSize().height);
      this.robotModelMaster = new RobotModelMaster(this.mazeModel, start, Direction.North);
      this.robotModelClient = new RobotModel(this.robotModelMaster);
      this.initialize();
   }
View Full Code Here


      interp.set("Forward", RobotStep.MoveForward);
      interp.set("Back", RobotStep.MoveBackward);
      interp.set("Left", RobotStep.RotateLeft);
      interp.set("Right", RobotStep.RotateRight);
      //We create and set a dummy maze variable so the user can analyze its methods.
      interp.set(ROBOT_MODEL_VAR_NAME, new RobotModel(new RobotModelMaster(new MazeModel(),
                                                                           MazeCell.valueOf(1, 16),
                                                                           Direction.North)));
      return interp;
   }
View Full Code Here

    * This runs in a background thread and handles the animation loop.
    */
   @Override
   public void run()
   {
      final RobotModelMaster model = this.robot.getRobotModelMaster();
      this.view.setRobotPosition(this.view.getCellCenterInner(model.getCurrentLocation()),
                                 model.getDirection().getRadians());
      this.view.invalidateAllCells();
      this.view.setRobotPathModel(model.getRobotPathModel());
      this.setViewAttributes();
      while (this.currentState != AnimationStates.Stopped && this.robot.isRobotDone() == false)
      {
         try
         {
            //Get the robots current position.
            final Point srcLocation = this.view.getCellCenterInner(model.getCurrentLocation());
            final Direction srcDirection = model.getDirection();
            final double srcRotation = srcDirection.getRadians();

            robot.nextStep(); //Move robot.

            //Get the robots new position.
            final Point destLocation = this.view.getCellCenterInner(model.getCurrentLocation());
            final Direction destDirection = model.getDirection();
            //Set our new rotation based on which way we turned.
            final double destRotation;
            if (srcDirection.getLeft() == destDirection)
               destRotation = srcRotation - Math.PI / 2;
            else if (srcDirection.getRight() == destDirection)
View Full Code Here

TOP

Related Classes of maze.model.RobotModelMaster$RobotCrashedException

Copyright © 2018 www.massapicom. 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.