Libraryless. Click here for Pure Java version (7713L/52K/180K).
!7 p { final File file = getProgramFile(#1007478, "my-universe.txt"); final JTextField tf = jtextfield(trim(loadTextFile(file, aGlobalID()))); showForm("Choose your universe", tf, r-thread { pcall-messagebox { S myUniverse = assertPossibleGlobalID(getTextTrim(tf)); saveTextFile(file, myUniverse); RemoteDB db = new RemoteDB(#1006463, true); // auto start AI Concepts L<RC> l = db.xlist("AIConcept"); bool haveUniverse = false; print("Found " + n(l, "concepts")); for (RC rc : l) { S id = rc.getString("globalID"); if (eq(id, myUniverse)) haveUniverse = true; S u = rc.getString("originatingUniverse"); print(rc.id + ": " + u); if (empty(u)) { print(" => Adopting to " + myUniverse + "!"); rc.set(originatingUniverse := myUniverse); } } if (!haveUniverse) { print("Making universe concept " + myUniverse); db.xnew("AIConcept", globalID := myUniverse, name := "My Universe", comment := "Feel free to rename this.", originatingUniverse := myUniverse); } db.close(); print("Done!"); } }); }
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: | #1007478 | 
| Snippet name: | Set originatingUniverse of all AI concepts [WORKS] | 
| Eternal ID of this version: | #1007478/17 | 
| Text MD5: | 19ab07c473eae026241a7cf0b942427d | 
| Transpilation MD5: | 504e3cde8733e9230a466aab642b6ed7 | 
| Author: | stefan | 
| Category: | javax / a.i. | 
| Type: | JavaX source code | 
| Public (visible to everyone): | Yes | 
| Archived (hidden from active list): | No | 
| Created/modified: | 2017-03-24 14:21:03 | 
| Source code size: | 1192 bytes / 32 lines | 
| Pitched / IR pitched: | No / No | 
| Views / Downloads: | 752 / 1571 | 
| Version history: | 16 change(s) | 
| Referenced in: | [show references] |