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: 741 / 1238
Referenced in: #3000185 - Answer for stefanreich
#3000202 - Answer for stefanreich (>> T conversion bot)
#3000203 - Answer for stefanreich (>> timing hello bot)
#3000208 - Answer for bgrgndz (>> list sub bots)
#3000209 - Answer for bgrgndz (>> list sub bots)
#3000238 - Answer for stefanreich (>> t power bot)
#3000369 - Answer for Stefan (>> list sub bots)
#3000376 - Answer for stefanreich (>> list sub bots)
#3000377 - Answer for stefanreich (>> timing eleu?)
#3000380 - Answer for stefanreich (>> list sub bots)
#3000381 - Answer for speedforce (>> list sub bots)
#3000382 - Answer for ferdie (>> t = 1, f = 0)