!7 sclass Node { S id, name; *() {} *(S *id, S *name) {} } sS meID = 'liahcrxesjjuwuur, functionsID = 'dudnfsbhcgoeudhs; static new L functions; static Canvas canvas; p-subst { functions = persistentList("Functions"); canvas = showCAL(diagram(), 650, 450); doFrameTitle(); calcOnConceptChanges(1000, r { canvas = showCAL(diagram(), canvas); doFrameTitle() }, false); bot("Soul."); showCommandList(); } svoid doFrameTitle { setFrameTitle("Soul Bot - Happiness Level: " + happiness(), canvas); } static CirclesAndLines diagram() { new CirclesAndLines cal; // Static circles Circle me = cal.circle("Me\n(Voice Assistant)\n\n" + meID, halfSizeImage(quickVisualize("Voice assistant")), 0.2, 0.4); int size = l(functions)*20+4; Circle f = cal.circle(whiteImage(size, size), 0.7, 0.65, n(functions, "function") + "\n(collection)\n\n" + functionsID); cal.arrow(me, "has", f); // Dynamically changing circles int i = 0; for (Node n : functions) { double x = 0.5 + (i++)*0.35/max(1, l(functions)-1); Circle fn = cal.circle(whiteImage(20, 20), x, 0.1, quote(n.name)); cal.arrow(f, "contains", fn); } ret cal; } static int happiness() { ret 1+l(functions); } answer { if "add function *" { functions.add(new Node(aGlobalID(), $1)); ret "OK"; } if "remove function *" { removeWhereParams(functions, id := $1); removeWhereParams(functions, name := $1); ret "OK"; } }