Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package tests;
- import model.*;
- import java.util.ArrayList;
- public class TestBots {
- public static void main(String[] args) {
- ArrayList<Entity> entities=new ArrayList<>();
- //(Location loc, int id, Directions dir, int moveSpeed)
- entities.add(new FlexibleBot(new Location(1,1), 1234, Movable.Directions.UP,Movable.FAST_SPEED));
- entities.add(new FlexibleBot(new Location(2,2), 4321, Movable.Directions.LEFT,Movable.SLOW_SPEED));
- Map m=new Map(entities);
- m.printMap();
- FlexibleBot f=(FlexibleBot) m.removeBotFromMap(((FlexibleBot) entities.get(0)));
- f.move(m);
- m.putBotOnMap(f);
- m.printMap();
- ((FlexibleBot)entities.get(1)).move(m);
- m.updateMap();
- m.printMap();
- }
- }
- package tests;
- import model.*;
- public class TestPolyInterface {
- public static void main(String[] args) {
- }
- public static boolean testFlexMove(FlexibleBot flex, Map m){
- return flex.move(m);
- }
- public static void testSpeedUp(Movable mover, Map m, int speedUpFactor){
- m.printMap();
- moveMovables(mover, m);
- m.printMap();
- Movable.speedUpByValue((Entity)mover, speedUpFactor);
- moveMovables(mover, m);
- m.printMap();
- }
- public static boolean moveMovables(Movable move, Map map){
- boolean moved=false;
- map.removeBotFromMap((Bot)move);
- moved=move.move(map);
- map.putBotOnMap((Bot)move);
- return moved;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement