Download Jar. Uses 4489K of libraries. Click here for Pure Java version (15097L/108K).
!7 static Web web; static Canvas canvas; static IVar<Int> thinkAheadDays = new Var(7); // now including today static new Var<CirclesAndLines> cal; svoid initWeb { web.node("Today"); } p-subst { thinkAheadDays = persistentVar("Think ahead this many days", thinkAheadDays!); web = persistentObject("Web", Web); web.useCLParse = false; web.onNewLabel.add(voidfunc(WebNode node, O label) { processNode(node); change(); }); initWeb(); cal.set(webToCAL(web)); canvas = showCAL(cal!, 650, 450); calAddAutoLayoutSwitch(cal, canvas, voidfunc(CALSpringLayout layout) { layout.desiredLength = 0.25; }, true); calcOnConceptChanges(1000, r { webToCAL(web, cal!, canvas) }, false); botWithCommandList("Current Day."); } answer { if "clear" { web.clear(); initWeb(); ret "OK"; } if "make days" { makeDays(); ret "OK"; } if "make * days" { thinkAheadDays.set(parseInt($1)); makeDays(); ret "OK"; } } sS dayName(int n) { ret n == 1 ? "Tomorrow" : "In " + n + " days"; } svoid makeDays { WebNode day = web.node("Today"); Calendar now = Calendar.getInstance(); addDate(day, now); for (int n = 1; n < thinkAheadDays!; n++) { day = web_followOrMakeForwardRelation(day, "Next day", dayName(n)); now.add(Calendar.DATE, 1); addDate(day, now); } } svoid addDate(WebNode day, Calendar now) { S date = englishMonthName(now.get(Calendar.MONTH)+1) + " " + now.get(Calendar.DAY_OF_MONTH); S origDate = web_stringLabel(day, 1); if (notNullAndDifferent(origDate, date)) fail(); day.addLabel(date); } svoid processNode(WebNode node) {}
Began life as a copy of #1009831
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: | #1009839 |
Snippet name: | Today Bot [OK] |
Eternal ID of this version: | #1009839/26 |
Text MD5: | 648716eac2139518441bb2931c347afd |
Transpilation MD5: | 1258074e425280982cb92d5e0ca68d37 |
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-23 02:39:41 |
Source code size: | 1643 bytes / 56 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 707 / 2014 |
Version history: | 25 change(s) |
Referenced in: | #1009876 - Find out what to do today [OK] |