Download Jar. Uses 4489K of libraries. Click here for Pure Java version (12324L/88K).
1 | !7 |
2 | |
3 | sclass Node { |
4 | S id, name; |
5 | *() {} *(S *id, S *name) {} |
6 | } |
7 | |
8 | sS meID = 'liahcrxesjjuwuur, functionsID = 'dudnfsbhcgoeudhs; |
9 | static new L<Node> functions; |
10 | |
11 | static Canvas canvas; |
12 | |
13 | p-subst { |
14 | functions = persistentList("Functions"); |
15 | canvas = showCAL(diagram(), 650, 450); |
16 | doFrameTitle(); |
17 | calcOnConceptChanges(1000, r { canvas = showCAL(diagram(), canvas); doFrameTitle() }, false); |
18 | bot("Soul."); |
19 | showCommandList(); |
20 | } |
21 | |
22 | svoid doFrameTitle { |
23 | setFrameTitle("Soul Bot - Happiness Level: " + happiness(), canvas); |
24 | } |
25 | |
26 | static CirclesAndLines diagram() { |
27 | new CirclesAndLines cal; |
28 | |
29 | // Static circles |
30 | Circle me = cal.circle("Me\n(Voice Assistant)\n\n" + meID, halfSizeImage(quickVisualize("Voice assistant")), 0.2, 0.4); |
31 | int size = l(functions)*20+4; |
32 | Circle f = cal.circle(whiteImage(size, size), 0.7, 0.65, n(functions, "function") + "\n(collection)\n\n" + functionsID); |
33 | cal.arrow(me, "has", f); |
34 | |
35 | // Dynamically changing circles |
36 | int i = 0; |
37 | for (Node n : functions) { |
38 | double x = 0.5 + (i++)*0.35/max(1, l(functions)-1); |
39 | Circle fn = cal.circle(whiteImage(20, 20), x, 0.1, quote(n.name)); |
40 | cal.arrow(f, "contains", fn); |
41 | } |
42 | ret cal; |
43 | } |
44 | |
45 | static int happiness() { ret 1+l(functions); } |
46 | |
47 | answer { |
48 | if "add function *" { functions.add(new Node(aGlobalID(), $1)); ret "OK"; } |
49 | if "remove function *" { removeWhereParams(functions, id := $1); removeWhereParams(functions, name := $1); ret "OK"; } |
50 | } |
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1009821 |
Snippet name: | Soul for a bot |
Eternal ID of this version: | #1009821/34 |
Text MD5: | 7f1932401c539d1cf3688ef3e2db9915 |
Transpilation MD5: | 485d011cbc101553c17e99de6ab7ec65 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-08-20 03:06:34 |
Source code size: | 1479 bytes / 50 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 626 / 1480 |
Version history: | 33 change(s) |
Referenced in: | [show references] |