Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

18
LINES

< > BotCompany Repo | #1002513 // Weekdays Bot (dev.)

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (799L/6K/19K).

1  
!752
2  
3  
answer {
4  
  if (match("if * was yesterday, what will be tomorrow?", s, m)
5  
    || match("if * was yesterday, what is tomorrow?", s, m)
6  
    || match("if * was yesterday, tomorrow is...?", s, m))
7  
    ret toWeekDay(fromWeekDay(m.unq(0))+2);
8  
}
9  
10  
static L<S> weekdays = litlist("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday");
11  
12  
static S toWeekDay(int n) {
13  
  ret weekdays.get(mod(n, 7));
14  
}
15  
16  
static int fromWeekDay(S day) {
17  
  ret indexOfIgnoreCase(weekdays, day);
18  
}

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: #1002513
Snippet name: Weekdays Bot (dev.)
Eternal ID of this version: #1002513/1
Text MD5: 22eda41e75db3e6ce43b661bba65cf5a
Transpilation MD5: 6ba7f20c98475ad244c61189a4ddcb24
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-01-29 02:16:32
Source code size: 508 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 669 / 1146
Referenced in: [show references]