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

32
LINES

< > BotCompany Repo | #1006408 // Computer! Can we...? [dev.]

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

Libraryless. Click here for Pure Java version (4532L/33K/99K).

1  
!7
2  
3  
/*
4  
proc "Computer! Can we $task?" {
5  
  find $program that fulfills $task;
6  
  if ($program != null)
7  
    print("Yes, with this program: " + programInfo($program));
8  
  else
9  
    print("I did not find a program for that.");
10  
}
11  
*/
12  
13  
p-type {
14  
  makeBot();
15  
}
16  
17  
answer {
18  
  if (flexMatchDropPunctuation("Computer! Can we *?", s, m)
19  
    || flexMatchDropPunctuation("Can we *?", s, m)) {
20  
    S task = $1;
21  
    print("Looking for " + quote(task) + "...");
22  
    Snippet program = findProgramThatFulfills(task);
23  
    if (program != null)
24  
      ret "Maybe with this program? " + snippetWithTitle(program);
25  
    else
26  
      ret "I did not find a program for that.";
27  
  }
28  
}
29  
30  
static Snippet findProgramThatFulfills(S task) {
31  
  ret first(tbSearchRunnableQuick(1, task));
32  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1006408
Snippet name: Computer! Can we...? [dev.]
Eternal ID of this version: #1006408/1
Text MD5: 4c88bf7b19d3a8adb34bad7b4d7c1eaa
Transpilation MD5: 500d56ada16d9693e9974c0921a2b479
Author: stefan
Category: javax / a.i.
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-01-01 18:50:54
Source code size: 775 bytes / 32 lines
Pitched / IR pitched: No / No
Views / Downloads: 522 / 652
Referenced in: [show references]