Libraryless. Click here for Pure Java version (1739L/11K/36K).
1 | !752 |
2 | |
3 | static class Sister { |
4 | S name, url, robotURL; |
5 | } |
6 | |
7 | static Sister sister; |
8 | |
9 | p { |
10 | load("sister"); |
11 | } |
12 | |
13 | static boolean has() { |
14 | ret sister != null; |
15 | } |
16 | |
17 | synchronized answer { |
18 | if "do you have a sister" |
19 | ret yn(has()); |
20 | if "what is your sister's name" |
21 | if (!has()) |
22 | ret "Ain't got no sister yo"; |
23 | else |
24 | ret or(sister.name, "I don't know"); |
25 | if "what is your sister's url" |
26 | if (!has()) |
27 | ret "Ain't got no sister yo"; |
28 | else |
29 | ret or(sister.url, "I don't know"); |
30 | if "what is your sister's robot url" |
31 | if (!has()) |
32 | ret "Ain't got no sister yo"; |
33 | else |
34 | ret or(sister.robotURL, "I don't know"); |
35 | |
36 | if (master()) { |
37 | // master stuff |
38 | |
39 | if "now you have a sister" { |
40 | makeSister(); |
41 | ret "Cool!"; |
42 | } |
43 | |
44 | if "you have no sister anymore" { |
45 | if (has()) { |
46 | sister = null; |
47 | save("sister"); |
48 | ret "Aw... what happened to her?"; |
49 | } |
50 | ret "Woot? Didn't have one anyway"; |
51 | } |
52 | |
53 | if "your sister's name is *" exceptionToUser { |
54 | if (!has()) makeSister(); |
55 | sister.name = eqic("unknown", m.unq(0)) ? null : m.unq(0); |
56 | save("sister"); |
57 | ret "OK!"; |
58 | } |
59 | |
60 | if "your sister's url is *" exceptionToUser { |
61 | S url = m.unq(0); |
62 | if (!has()) makeSister(); |
63 | if (eqic("unknown", url)) |
64 | sister.url = null; |
65 | else { |
66 | assertTrue("not an url", isURL(url)); |
67 | sister.url = url; |
68 | } |
69 | save("sister"); |
70 | ret "OK!"; |
71 | } |
72 | |
73 | if "your sister's robot url is *" exceptionToUser { |
74 | S url = m.unq(0); |
75 | if (!has()) makeSister(); |
76 | if (eqic("unknown", url)) |
77 | sister.robotURL = null; |
78 | else { |
79 | assertTrue("not an url", isURL(url)); |
80 | sister.robotURL = url; |
81 | } |
82 | save("sister"); |
83 | ret "OK!"; |
84 | } |
85 | } |
86 | } |
87 | |
88 | static synchronized Sister _get() { |
89 | ret sister; |
90 | } |
91 | |
92 | static void makeSister() { |
93 | sister = new Sister; |
94 | save("sister"); |
95 | } |
Began life as a copy of #1002596
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: | #1002626 |
Snippet name: | Sister Bot |
Eternal ID of this version: | #1002626/1 |
Text MD5: | c14d677c74c5ca39497bb05eb0b9785b |
Transpilation MD5: | cf32773b94562aa1d4d2998faa5a4a41 |
Author: | stefan |
Category: | eleu |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-02-11 01:35:16 |
Source code size: | 2036 bytes / 95 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 654 / 1259 |
Referenced in: | [show references] |