use of nars.op.stm.STMLinkage in project narchy by automenta.
the class NAgentTest method testSameCheat.
// n.onTask(t->{
// if (t.isGoal()) {
// if (t.term().equals(action))
// System.out.println(t.start() + ".." + t.end() + "\t" + t.proof());
// }
// });
@Test
public void testSameCheat() {
Param.DEBUG = true;
NAR n = new NARS().get();
Term action = $.$$("(t,y)");
Deriver d = new Deriver(n.exe::fire, (Collection<Task> x) -> {
// HACK TODO this is more efficiently done by filtering the rules rather than the results!
Collection<Task> filtered = Collections2.filter(x, Task::isGoal);
if (!filtered.isEmpty()) {
// System.out.println(filtered);
Collection<Task> filterAction = Collections2.filter(filtered, (t) -> t.term().equals(action));
filterAction.forEach(t -> {
System.out.println(t.proof());
System.out.println();
});
}
n.input(filtered);
}, Derivers.rules(1, 8, n).compile(), n);
new STMLinkage(n, 1, false);
d.conceptsPerIteration.set(8);
// n.log();
MiniTest a = new ToggleSame(n, $.the("t"), // $.$safe("t:y"),
action, true);
// n.onCycle(a::run);
// n.run(100);
// n.goal("(t,y)", Tense.Present, 1f);
n.synch();
Term ax = IMPL.the(action, 0, a.happy.filter[0].term);
n.believe(ax, Tense.Present);
a.runSynch(1500);
assertTrue(a.avgReward() > 0.1f);
assertTrue(a.dex.getMean() > 0f);
}
Aggregations