Examples of XYLocation


Examples of aima.core.util.datastructure.XYLocation

    Assert.assertEquals(4, loc.getYCoOrdinate());
  }

  @Test
  public void testEquality() {
    XYLocation loc1 = new XYLocation(3, 4);
    XYLocation loc2 = new XYLocation(3, 4);
    Assert.assertEquals(loc1, loc2);
  }
View Full Code Here

Examples of aima.core.util.datastructure.XYLocation

  @Before
  public void setUp() {
    env = new XYEnvironment(10, 12);
    a = new MockAgent();
    env.addObjectToLocation(a, new XYLocation(3, 4));
  }
View Full Code Here

Examples of aima.core.util.datastructure.XYLocation

  }

  @Test
  public void testAddObject() {
    Assert.assertEquals(1, env.getAgents().size());
    Assert.assertEquals(new XYLocation(3, 4), env.getCurrentLocationFor(a));
  }
View Full Code Here

Examples of aima.core.util.datastructure.XYLocation

    Assert.assertEquals(new XYLocation(3, 4), env.getCurrentLocationFor(a));
  }

  @Test
  public void testAddObject2() {
    env.addObjectToLocation(new Wall(), new XYLocation(9, 9));
    Assert.assertEquals(1, env.getAgents().size());
    Assert.assertEquals(2, env.getEnvironmentObjects().size());
    Assert.assertEquals(1, env.getObjectsAt(new XYLocation(9, 9)).size());
  }
View Full Code Here

Examples of aima.core.util.datastructure.XYLocation

  }

  @Test
  public void testAddObjectTwice() {
    Assert.assertEquals(1, env.getAgents().size());
    XYLocation loc = new XYLocation(5, 5);
    AbstractAgent b = new MockAgent();
    env.addObjectToLocation(b, loc);
    Assert.assertEquals(2, env.getAgents().size());

    Assert.assertEquals(loc, env.getCurrentLocationFor(b));
View Full Code Here

Examples of aima.core.util.datastructure.XYLocation

    Assert.assertEquals(loc, env.getCurrentLocationFor(b));
  }

  @Test
  public void testMoveObjectToAbsoluteLocation() {
    XYLocation loc = new XYLocation(5, 5);
    env.moveObjectToAbsoluteLocation(a, loc);
    Assert.assertEquals(new XYLocation(5, 5), env.getCurrentLocationFor(a));
  }
View Full Code Here

Examples of aima.core.util.datastructure.XYLocation

    Assert.assertEquals(new XYLocation(5, 5), env.getCurrentLocationFor(a));
  }

  @Test
  public void testMoveObject() {
    XYLocation loc = new XYLocation(5, 5);
    env.moveObjectToAbsoluteLocation(a, loc);
    Assert.assertEquals(new XYLocation(5, 5), env.getCurrentLocationFor(a));
    env.moveObject(a, XYLocation.Direction.North);
    Assert.assertEquals(new XYLocation(5, 4), env.getCurrentLocationFor(a));
    env.moveObject(a, XYLocation.Direction.East);
    Assert.assertEquals(new XYLocation(6, 4), env.getCurrentLocationFor(a));
    env.moveObject(a, XYLocation.Direction.South);
    Assert.assertEquals(new XYLocation(6, 5), env.getCurrentLocationFor(a));
    env.moveObject(a, XYLocation.Direction.West);
    Assert.assertEquals(new XYLocation(5, 5), env.getCurrentLocationFor(a));
  }
View Full Code Here

Examples of aima.core.util.datastructure.XYLocation

    Assert.assertEquals(new XYLocation(5, 5), env.getCurrentLocationFor(a));
  }

  @Test
  public void testIsBlocked() {
    XYLocation loc = new XYLocation(5, 5);
    Assert.assertEquals(0, env.getObjectsAt(loc).size());
    Assert.assertEquals(false, env.isBlocked(loc));
    env.addObjectToLocation(new Wall(), loc);
    Assert.assertEquals(1, env.getObjectsAt(loc).size());
    Assert.assertEquals(true, env.isBlocked(loc));
View Full Code Here

Examples of aima.core.util.datastructure.XYLocation

    Assert.assertEquals(true, env.isBlocked(loc));
  }

  @Test
  public void testMoveWithBlockingWalls() {
    XYLocation loc = new XYLocation(5, 5);
    env.moveObjectToAbsoluteLocation(a, loc);
    XYLocation northLoc = new XYLocation(5, 6);
    XYLocation southLoc = new XYLocation(5, 4);
    XYLocation westLoc = new XYLocation(4, 5);

    env.addObjectToLocation(new Wall(), northLoc); // wall to the north of
    // object
    Assert.assertTrue(env.isBlocked(northLoc));
    env.addObjectToLocation(new Wall(), southLoc); // wall to the south of
    // object
    env.addObjectToLocation(new Wall(), westLoc); // wall to the west of
    // object
    Assert.assertEquals(4, env.getEnvironmentObjects().size());

    env.moveObject(a, XYLocation.Direction.North); // should not move
    env.moveObject(a, XYLocation.Direction.South); // should not move
    env.moveObject(a, XYLocation.Direction.West); // should not move
    env.moveObject(a, XYLocation.Direction.East); // SHOULD move
    Assert.assertEquals(new XYLocation(6, 5), env.getCurrentLocationFor(a));
  }
View Full Code Here

Examples of aima.core.util.datastructure.XYLocation

    Assert.assertEquals(new XYLocation(6, 5), env.getCurrentLocationFor(a));
  }

  @Test
  public void testGetObjectsAt() {
    XYLocation loc = new XYLocation(5, 7);
    env.moveObjectToAbsoluteLocation(a, loc);
    Assert.assertEquals(1, env.getObjectsAt(loc).size());
    AbstractAgent b = new MockAgent();
    env.addObjectToLocation(b, loc);
    Assert.assertEquals(2, env.getObjectsAt(loc).size());
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.