Search in sources :

Example 16 with VacuumEnvironment

use of aima.core.environment.vacuum.VacuumEnvironment in project aima-java by aimacode.

the class SimpleReflexVacuumAgentTest method testDirtyDirty.

@Test
public void testDirtyDirty() {
    VacuumEnvironment tve = new VacuumEnvironment(VacuumEnvironment.LocationState.Dirty, VacuumEnvironment.LocationState.Dirty);
    tve.addAgent(agent, VacuumEnvironment.LOCATION_A);
    tve.addEnvironmentView(new VacuumEnvironmentViewActionTracker(envChanges));
    tve.step(8);
    Assert.assertEquals("Action[name==Suck]Action[name==Right]Action[name==Suck]Action[name==Left]Action[name==Right]Action[name==Left]Action[name==Right]Action[name==Left]", envChanges.toString());
}
Also used : VacuumEnvironmentViewActionTracker(aima.core.environment.vacuum.VacuumEnvironmentViewActionTracker) VacuumEnvironment(aima.core.environment.vacuum.VacuumEnvironment) Test(org.junit.Test)

Example 17 with VacuumEnvironment

use of aima.core.environment.vacuum.VacuumEnvironment in project aima-java by aimacode.

the class TableDrivenVacuumAgentTest method testDirtyClean.

@Test
public void testDirtyClean() {
    VacuumEnvironment tve = new VacuumEnvironment(VacuumEnvironment.LocationState.Dirty, VacuumEnvironment.LocationState.Clean);
    tve.addAgent(agent, VacuumEnvironment.LOCATION_A);
    tve.addEnvironmentView(new VacuumEnvironmentViewActionTracker(envChanges));
    tve.stepUntilDone();
    Assert.assertEquals("Action[name==Suck]Action[name==Right]Action[name==Left]Action[name==NoOp]", envChanges.toString());
}
Also used : VacuumEnvironmentViewActionTracker(aima.core.environment.vacuum.VacuumEnvironmentViewActionTracker) VacuumEnvironment(aima.core.environment.vacuum.VacuumEnvironment) Test(org.junit.Test)

Example 18 with VacuumEnvironment

use of aima.core.environment.vacuum.VacuumEnvironment in project aima-java by aimacode.

the class VacuumEnvironmentViewCtrl method initialize.

@Override
public void initialize(Environment env) {
    if (env instanceof VacuumEnvironment) {
        this.locations = ((VacuumEnvironment) env).getLocations();
        envStateView.getChildren().clear();
        envStateView.getColumnConstraints().clear();
        ColumnConstraints colCons = new ColumnConstraints();
        colCons.setPercentWidth(100.0 / locations.size());
        int i = 0;
        for (String loc : locations) {
            BorderPane pane = new BorderPane();
            pane.setTop(new Label(loc));
            pane.setStyle("-fx-background-color: white");
            envStateView.add(pane, i++, 0);
            envStateView.getColumnConstraints().add(colCons);
        }
    }
    super.initialize(env);
}
Also used : BorderPane(javafx.scene.layout.BorderPane) VacuumEnvironment(aima.core.environment.vacuum.VacuumEnvironment) ColumnConstraints(javafx.scene.layout.ColumnConstraints) Label(javafx.scene.control.Label)

Example 19 with VacuumEnvironment

use of aima.core.environment.vacuum.VacuumEnvironment in project aima-java by aimacode.

the class SimpleReflexVacuumAgentTest method testCleanDirty.

@Test
public void testCleanDirty() {
    VacuumEnvironment tve = new VacuumEnvironment(VacuumEnvironment.LocationState.Clean, VacuumEnvironment.LocationState.Dirty);
    tve.addAgent(agent, VacuumEnvironment.LOCATION_A);
    tve.addEnvironmentView(new VacuumEnvironmentViewActionTracker(envChanges));
    tve.step(8);
    Assert.assertEquals("Action[name==Right]Action[name==Suck]Action[name==Left]Action[name==Right]Action[name==Left]Action[name==Right]Action[name==Left]Action[name==Right]", envChanges.toString());
}
Also used : VacuumEnvironmentViewActionTracker(aima.core.environment.vacuum.VacuumEnvironmentViewActionTracker) VacuumEnvironment(aima.core.environment.vacuum.VacuumEnvironment) Test(org.junit.Test)

Example 20 with VacuumEnvironment

use of aima.core.environment.vacuum.VacuumEnvironment in project aima-java by aimacode.

the class SimpleReflexVacuumAgentTest method testCleanClean.

@Test
public void testCleanClean() {
    VacuumEnvironment tve = new VacuumEnvironment(VacuumEnvironment.LocationState.Clean, VacuumEnvironment.LocationState.Clean);
    tve.addAgent(agent, VacuumEnvironment.LOCATION_A);
    tve.addEnvironmentView(new VacuumEnvironmentViewActionTracker(envChanges));
    tve.step(8);
    Assert.assertEquals("Action[name==Right]Action[name==Left]Action[name==Right]Action[name==Left]Action[name==Right]Action[name==Left]Action[name==Right]Action[name==Left]", envChanges.toString());
}
Also used : VacuumEnvironmentViewActionTracker(aima.core.environment.vacuum.VacuumEnvironmentViewActionTracker) VacuumEnvironment(aima.core.environment.vacuum.VacuumEnvironment) Test(org.junit.Test)

Aggregations

VacuumEnvironment (aima.core.environment.vacuum.VacuumEnvironment)28 Test (org.junit.Test)24 VacuumEnvironmentViewActionTracker (aima.core.environment.vacuum.VacuumEnvironmentViewActionTracker)16 Agent (aima.core.agent.Agent)2 ModelBasedReflexVacuumAgent (aima.core.environment.vacuum.ModelBasedReflexVacuumAgent)2 BorderPane (javafx.scene.layout.BorderPane)2 Environment (aima.core.agent.Environment)1 EnvironmentView (aima.core.agent.EnvironmentView)1 SimpleEnvironmentView (aima.core.agent.impl.SimpleEnvironmentView)1 Label (javafx.scene.control.Label)1 ColumnConstraints (javafx.scene.layout.ColumnConstraints)1 Before (org.junit.Before)1