use of nars.NAR in project narchy by automenta.
the class PrologCoreTest method testConjunction3b.
@Test
public void testConjunction3b() throws Exception {
NAR n = NARS.tmp();
Param.DEBUG = true;
PrologCore p = new PrologCore(n);
n.believe("x:a");
assertTrue(p.isTrue("'-->'(a,x)."));
assertFalse(p.isTrue("'-->'(a,y)."));
n.believe("y:b");
n.believe("z:c", false);
n.run(1);
assertTrue(p.isTrue("'-->'(a,x), '-->'(b,y)."));
assertTrue(p.isTrue("'-->'(a,x), '-->'(b,y), '--'('-->'(c,z))."));
assertFalse(p.isTrue("'-->'(a,x), '-->'(b,y), '-->'(c,z)."));
// assertTrue(p.isTrue("','(a,','(b,c))."));
}
use of nars.NAR in project narchy by automenta.
the class PrologCoreTest method testPrologCoreDerivedTransitive2.
@Test
public void testPrologCoreDerivedTransitive2() throws Narsese.NarseseException {
NAR n = NARS.tmp();
PrologCore p = new PrologCore(n);
n.input("a:b.");
n.input("b:c.");
n.input("c:d.");
n.input("d:e.");
n.input("e:f.");
n.run(1);
n.input("a:f?");
// expect true
n.run(1);
n.input("a:?x?");
// expect true
n.run(1);
}
use of nars.NAR in project narchy by automenta.
the class PrologCoreTest method testPrologShell.
@Test
public void testPrologShell() throws MalformedGoalException {
NAR n = NARS.tmp();
PrologCore p = new PrologCore(n);
try {
p.input(new Theory(PrologCoreTest.class.getClassLoader().getResource("shell.prolog").openStream()));
} catch (InvalidTheoryException | IOException e) {
e.printStackTrace();
}
p.solve("do(help).");
}
use of nars.NAR in project narchy by automenta.
the class PrologCoreTest method testPrologCoreImplToRule.
@Test
public void testPrologCoreImplToRule() throws Narsese.NarseseException {
NAR n = NARS.tmp(1);
n.log();
Param.DEBUG = true;
PrologCore p = new PrologCore(n);
n.input("f(x,y).");
n.input("(f($x,$y)==>g($y,$x)).");
n.run(1);
n.input("g(x,y)?");
n.input("g(y,x)?");
n.run(1);
assertEquals(1f, n.beliefTruth("g(y,x)", ETERNAL).freq());
assertNull(n.beliefTruth("g(x,y)", ETERNAL));
}
use of nars.NAR in project narchy by automenta.
the class BooleanChallenge method main.
public static void main(String[] args) {
Global.DEBUG = true;
NAR n = new NAR(new Equalized(1024, 4, 3).setInternalExperience(null));
// NAR n = new NAR(new Discretinuous());
// new NARPrologMirror(n, 0.95f, true, true, false);
// NAR n = new CurveBagNARBuilder().builder();
// new TraceWriter(n, System.out);
new TextOutput(n, System.out);
new BooleanChallenge(n, 2, 122550, 0.65f).getScore();
}
Aggregations