Search in sources :

Example 6 with WumpusKnowledgeBase

use of aima.core.environment.wumpusworld.WumpusKnowledgeBase in project aima-java by aimacode.

the class WumpusKnowledgeBaseTest method testAskNotUnsafeRooms.

@SuppressWarnings("serial")
@Test
public void testAskNotUnsafeRooms() {
    WumpusKnowledgeBase KB;
    int t = 0;
    KB = new WumpusKnowledgeBase(dpll, 2);
    step(KB, new AgentPercept(false, false, false, false, false), t);
    Assert.assertEquals(new HashSet<Room>() {

        {
            add(new Room(1, 1));
            add(new Room(1, 2));
            add(new Room(2, 1));
        }
    }, KB.askNotUnsafeRooms(t));
    KB = new WumpusKnowledgeBase(dpll, 2);
    step(KB, new AgentPercept(true, false, false, false, false), t);
    Assert.assertEquals(new HashSet<Room>() {

        {
            add(new Room(1, 1));
            add(new Room(1, 2));
            add(new Room(2, 1));
            add(new Room(2, 2));
        }
    }, KB.askNotUnsafeRooms(t));
}
Also used : AgentPercept(aima.core.environment.wumpusworld.AgentPercept) WumpusKnowledgeBase(aima.core.environment.wumpusworld.WumpusKnowledgeBase) Room(aima.core.environment.wumpusworld.Room) Test(org.junit.Test)

Example 7 with WumpusKnowledgeBase

use of aima.core.environment.wumpusworld.WumpusKnowledgeBase in project aima-java by aimacode.

the class WumpusKnowledgeBaseTest method testAskGlitter.

@Test
public void testAskGlitter() {
    WumpusKnowledgeBase KB = new WumpusKnowledgeBase(dpll, 2);
    step(KB, new AgentPercept(false, false, false, false, false), 0);
    Assert.assertFalse(KB.askGlitter(0));
    step(KB, new AgentPercept(false, false, false, false, false), 1);
    Assert.assertFalse(KB.askGlitter(1));
    step(KB, new AgentPercept(false, false, true, false, false), 2);
    Assert.assertTrue(KB.askGlitter(2));
    step(KB, new AgentPercept(false, false, false, false, false), 3);
    Assert.assertFalse(KB.askGlitter(3));
}
Also used : AgentPercept(aima.core.environment.wumpusworld.AgentPercept) WumpusKnowledgeBase(aima.core.environment.wumpusworld.WumpusKnowledgeBase) Test(org.junit.Test)

Aggregations

AgentPercept (aima.core.environment.wumpusworld.AgentPercept)7 WumpusKnowledgeBase (aima.core.environment.wumpusworld.WumpusKnowledgeBase)7 Test (org.junit.Test)7 AgentPosition (aima.core.environment.wumpusworld.AgentPosition)4 Room (aima.core.environment.wumpusworld.Room)4 Forward (aima.core.environment.wumpusworld.action.Forward)4 TurnLeft (aima.core.environment.wumpusworld.action.TurnLeft)1 TurnRight (aima.core.environment.wumpusworld.action.TurnRight)1