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).

!752

answer {
  if (match("if * was yesterday, what will be tomorrow?", s, m)
    || match("if * was yesterday, what is tomorrow?", s, m)
    || match("if * was yesterday, tomorrow is...?", s, m))
    ret toWeekDay(fromWeekDay(m.unq(0))+2);
}

static L<S> weekdays = litlist("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday");

static S toWeekDay(int n) {
  ret weekdays.get(mod(n, 7));
}

static int fromWeekDay(S day) {
  ret indexOfIgnoreCase(weekdays, day);
}

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: 739 / 1236
Referenced in: [show references]