use of nars.NAR in project narchy by automenta.
the class TestProloglike method testRiddle1.
@Test
public void testRiddle1() throws Exception {
// Param.DEBUG = true;
NAR n = NARS.tmp();
n.termVolumeMax.set(1024);
n.log();
n.inputNarsese(TestProloglike.class.getResource("einsteinsRiddle.nal"));
n.run(128);
}
use of nars.NAR in project narchy by automenta.
the class TermTreeTest method testCompoundInsertion.
@Test
public void testCompoundInsertion() throws Narsese.NarseseException {
TreeConceptIndex index;
NAR nar = new NARS().index(index = new TreeConceptIndex(1000)).get();
int preSize = index.size();
String[] terms = { "x", "(x)", "(xx)", "(xxx)", "(x,y)", "(x,z)", "(x --> z)", "(x <-> z)", "(x&&z)" };
HashSet<Term> input = new HashSet();
for (String s : terms) {
@NotNull Term ts = $(s);
input.add(ts);
index.get(ts, true);
}
assertEquals(terms.length + preSize, index.size());
for (Term x : input) assertNotNull(index.get(x, false));
// Set<Termed> stored = StreamSupport.stream(index.concepts.spliterator(), false).collect(Collectors.toSet());
// assertEquals(Sets.symmetricDifference(input, stored) + " = difference", input, stored);
index.concepts.prettyPrint();
index.print(System.out);
// String stringWithUnicode = "unicode\u00easomething";
// assertNull( tree.resolveOrAdd(stringWithUnicode)); //unicode not supported yet
}
use of nars.NAR in project narchy by automenta.
the class JsonTermTest method testBigJSON2.
@Test
public void testBigJSON2() {
/*
* https://eonet.sci.gsfc.nasa.gov/api/v2.1/events?limit=5&days=20&source=InciWeb&status=open
* https://worldview.earthdata.nasa.gov/config/wv.json
* */
String j = "{ \"id\": \"EONET_2797\",\n" + " \"title\": \"Snake Ridge Fire, ARIZONA\",\n" + " \"description\": \"\",\n" + " \"link\": \"http://eonet.sci.gsfc.nasa.gov/api/v2.1/events/EONET_2797\",\n" + " \"categories\": [\n" + " {\n" + " \"id\": 8,\n" + " \"title\": \"Wildfires\"\n" + " }\n" + " ] }";
NAR d = new NARS().get();
d.log();
d.believe($.inh($.fromJSON(j), "x"));
d.run(1000);
}
use of nars.NAR in project narchy by automenta.
the class JsonTermTest method testJsonArray.
@Test
public void testJsonArray() throws Narsese.NarseseException {
NAR d = new NARS().get();
d.log();
new TaskRule("(json,%1):{x(%2)}", "X(%1,%2)", d);
// d.believe( $.inh( JsonCompound.the("['a', 1, ['b', 'c']]"), $.the("(json,1)") ) );
// TaskProcess: $.50;.95$ (("a"),(1),(("b"),("c"))). %1.0;.90% {0: 1}
d.believe($.inh(JsonTerm.the("{ x: 3, y: [\"a\",4] }"), $.$("(json,2)")));
// d.believe( $.inh( JsonCompound.the("{ x: 3 }"), $.$("(json,2)") ) );
// $.15;.86$ X(3,2). %1.0;.81% {1: 1;;}
// $.50;.95$ {x(3),y(("a"),("b"))}. %1.0;.90% {0: 2}
d.run(256);
}
use of nars.NAR in project narchy by automenta.
the class SomeRovers method main.
public static void main(String[] args) {
Global.DEBUG = Global.EXIT_ON_EXCEPTION = false;
float fps = 60;
boolean cpanels = true;
RoverWorld world;
// world = new ReactorWorld(this, 32, 48, 48*2);
world = new FoodSpawnWorld1(128, 48, 48, 0.5f);
// world = new GridSpaceWorld(GridSpaceWorld.newMazePlanet());
final Sim game = new Sim(clock, world);
game.add(new Turret("turret"));
game.add(new Spider("spider", 3, 3, 0.618f, 30, 30));
{
NARSeed e = newDefault(3);
NAR nar = new NAR(e);
game.add(new Rover("r1", nar));
}
{
NAR nar = new NAR(newDefault(1));
// nar.param.outputVolume.set(0);
game.add(new CarefulRover("r2", nar));
/*if (cpanels) {
SwingUtilities.invokeLater(() -> {
new NARSwing(nar, false);
});
}*/
}
game.run(fps);
}
Aggregations