Package aima.core.agent.impl

Examples of aima.core.agent.impl.DynamicPercept


    Assert.assertEquals(
        "if ![car-in-front-is-braking==true] then Action[name==initiate-braking].",
        r.toString());

    Assert.assertEquals(false, r.evaluate(new DynamicPercept(
        ATTRIBUTE_CAR_IN_FRONT_IS_BRAKING, true)));

    Assert.assertEquals(true, r.evaluate(new DynamicPercept(
        ATTRIBUTE_CAR_IN_FRONT_IS_BRAKING, false)));

    Assert.assertEquals(true, r.evaluate(new DynamicPercept(
        ATTRIBUTE_CAR_IN_FRONT_IS_INDICATING, true)));
  }
View Full Code Here


    Assert.assertEquals(
        "if [car-in-front-is-braking==true && car-in-front-tires-smoking==true] then Action[name==emergency-braking].",
        r.toString());

    Assert.assertEquals(false, r.evaluate(new DynamicPercept(
        ATTRIBUTE_CAR_IN_FRONT_IS_BRAKING, true)));

    Assert.assertEquals(false, r.evaluate(new DynamicPercept(
        ATTRIBUTE_CAR_IN_FRONT_TIRES_SMOKING, true)));

    Assert.assertEquals(true, r.evaluate(new DynamicPercept(
        ATTRIBUTE_CAR_IN_FRONT_IS_BRAKING, true,
        ATTRIBUTE_CAR_IN_FRONT_TIRES_SMOKING, true)));

    Assert.assertEquals(false, r.evaluate(new DynamicPercept(
        ATTRIBUTE_CAR_IN_FRONT_IS_BRAKING, false,
        ATTRIBUTE_CAR_IN_FRONT_TIRES_SMOKING, true)));

    Assert.assertEquals(false, r.evaluate(new DynamicPercept(
        ATTRIBUTE_CAR_IN_FRONT_IS_BRAKING, true,
        ATTRIBUTE_CAR_IN_FRONT_TIRES_SMOKING, false)));
  }
View Full Code Here

    Assert.assertEquals(
        "if [car-in-front-is-braking==true || car-in-front-tires-smoking==true] then Action[name==emergency-braking].",
        r.toString());

    Assert.assertEquals(true, r.evaluate(new DynamicPercept(
        ATTRIBUTE_CAR_IN_FRONT_IS_BRAKING, true)));

    Assert.assertEquals(true, r.evaluate(new DynamicPercept(
        ATTRIBUTE_CAR_IN_FRONT_TIRES_SMOKING, true)));

    Assert.assertEquals(true, r.evaluate(new DynamicPercept(
        ATTRIBUTE_CAR_IN_FRONT_IS_BRAKING, true,
        ATTRIBUTE_CAR_IN_FRONT_TIRES_SMOKING, true)));

    Assert.assertEquals(true, r.evaluate(new DynamicPercept(
        ATTRIBUTE_CAR_IN_FRONT_IS_BRAKING, false,
        ATTRIBUTE_CAR_IN_FRONT_TIRES_SMOKING, true)));

    Assert.assertEquals(true, r.evaluate(new DynamicPercept(
        ATTRIBUTE_CAR_IN_FRONT_IS_BRAKING, true,
        ATTRIBUTE_CAR_IN_FRONT_TIRES_SMOKING, false)));

    Assert.assertEquals(false, r.evaluate(new DynamicPercept(
        ATTRIBUTE_CAR_IN_FRONT_IS_BRAKING, false,
        ATTRIBUTE_CAR_IN_FRONT_TIRES_SMOKING, false)));
  }
View Full Code Here

    return state;
  }

  @Override
  public Percept getPerceptSeenBy(Agent anAgent) {
    return new DynamicPercept(DynAttributeNames.PERCEPT_IN,
        getAgentLocation(anAgent));
  }
View Full Code Here

  //
  // PROTECTED METHODS
  //
  @Override
  protected State updateState(Percept p) {
    DynamicPercept dp = (DynamicPercept) p;

    state.setAttribute(DynAttributeNames.AGENT_LOCATION,
        dp.getAttribute(DynAttributeNames.PERCEPT_IN));

    return state;
  }
View Full Code Here

  }

  @Test
  public void testPerceptSeenBy() {
    me.addAgent(ma, "D");
    DynamicPercept p = (DynamicPercept) me.getPerceptSeenBy(ma);
    Assert.assertEquals(p.getAttribute(DynAttributeNames.PERCEPT_IN), "D");
  }
View Full Code Here

TOP

Related Classes of aima.core.agent.impl.DynamicPercept

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.