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

27
LINES

< > BotCompany Repo | #1002379 // How to solve the Turing Test

Document

1  
Basic idea: Connect Java and NL.
2  
3  
Example problem: Compare two numbers.
4  
5  
We need a MICROTHEORY and a PROGRAM.
6  
7  
MICROTHEORY:
8  
9  
  Two numbers A and B can be compared using "bigint(A).compareTo(bigint(B))".
10  
11  
For this microtheory, there will also exist a program that parses and "runs" it.
12  
13  
PROGRAM (PSEUDO-CODE):
14  
15  
  // prepare
16  
17  
  matchRule("Two numbers $1 and $2 can be compared using $3.");
18  
  S a, b, code = $1, $2, $3;
19  
20  
  // answer
21  
  
22  
  if (matchInput("Is $1 bigger than $2?")) {
23  
    int x = evalWith(code, a, $1, b, $2);
24  
    ret x > 0 ? "yes" : "no";
25  
  }
26  
27  
And that's it for this example.

download  show line numbers   

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

No comments. add comment

Snippet ID: #1002379
Snippet name: How to solve the Turing Test
Eternal ID of this version: #1002379/1
Text MD5: 2bef8fe08f4bd948059a617d22bfa726
Author: stefan
Category:
Type: Document
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-01-14 15:30:09
Source code size: 612 bytes / 27 lines
Pitched / IR pitched: No / No
Views / Downloads: 639 / 165
Referenced in: [show references]