abstract sclass Agent {
Collection<AIConcept> concepts; // input
new LinkedHashSet<S> statements; // output
int duplicates; // number of already known statements emitted
abstract void impl();
void emit(Lisp l) { emit(clUnparse(l)); }
void emit(S s) {
if (!isTruth(s) && statements.add(s))
print("> " + s + " - " + conceptLanguageToEnglish(s));
else ++duplicates;
}
void runLive(bool doIt) {
concepts = aiConcepts();
statements.clear();
impl();
S s = "Have " + n(statements, "statements") + " to add";
if (duplicates != 0)
s += " (+" + n(duplicates, "duplicate") + ")";
print(s);
if (doIt) {
print("ADDING.");
addTruth(statements);
}
}
void doIt { runLive(true); }
void testRun { runLive(false); }
void runLive(S[] args) {
runLive(eqic(get(args, 0), "doit"));
}
}Began life as a copy of #1007566
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1007580 |
| Snippet name: | Agent (class for logic agents) |
| Eternal ID of this version: | #1007580/15 |
| Text MD5: | 3f9d9d0858457c8eb7c2787c74b52cd3 |
| Author: | stefan |
| Category: | javax / a.i. |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-04-05 18:24:33 |
| Source code size: | 908 bytes / 36 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 1087 / 1679 |
| Version history: | 14 change(s) |
| Referenced in: | #1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674) |