Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class RoomModel { // In your model .java file
- private static final int WIDTH = 4;
- private static final int HEIGHT = 5;
- private int steps; //USE CONSTRUCTOR TO INITIALIZE.
- private Position = new Position();
- static class Position {
- // Not necessary to have nested class
- // but it is a good approach
- public int xPosition;
- public int yPosition;
- }
- // YOU WILL WRITE THESE METHODS
- public boolean canXXXX(){}
- public void moveXXXX(){}
- public void updateSteps(){}
- public int getSteps(){}
- }
- class Controller { // In your controller .java file
- public void onButtonClick(view View){
- if (model.canMoveXXXX()) {
- // the x- and y-coordinate of the robot are updated only if the robot can move (use your canGo????
- // methods to determine if robot can move), and
- model.moveXXX();
- }
- //the counter is incremented even if the robot cannot move in the direction corresponding to the pressed button.
- model.updateSteps();
- //We want to distinguish those buttons that capture directions in which the robot can move from the buttons
- //representing directions in which the robot cannot move. The former should be green, whereas the latter should be red.
- updateButtonStatus();
- updateLabel();
- }
- public void updateButtonStatus(){
- ButtonXXX.setBgColor((model.canMoveXXX())? Green : Red);
- }
- public void updateLabel(){} //method this.t(); in Prof's Webpage
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement