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

41
LINES

< > BotCompany Repo | #1003604 // Execute solving command

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

Libraryless. Click here for Pure Java version (1849L/12K/41K).

1  
!752
2  
3  
!include #1003606 // GenTesting
4  
5  
static int n = 4;
6  
static S solverID = "#1003632";
7  
8  
p {
9  
  // Just call another program's function... JavaX makes it possible!
10  
  O mainProg = hotwire("#1003582");
11  
  L<S> log = cast call(mainProg, "loadLog");
12  
  printStructureLines(log);
13  
  
14  
  // assume command is in last line...
15  
  log = dropLast(log);
16  
  
17  
  // shrink to number of wanted entries
18  
  log = getLast(log, n);
19  
  
20  
  GenTesting test = new GenTesting(voidfunc(L<Gen> gens, L<S> log) { makeGenerators(gens, log); });
21  
  test.comparison = "match";
22  
  int score = test.scoreGenerator(log, solverID);
23  
  if (score > 0) {
24  
    print("Yay! Solved! (" + score + "/" + n + ")");
25  
    print("Recommending...");
26  
    callOpt(mainProg, "recommendSolver", solverID);
27  
  } else
28  
    print("Not solved...");
29  
}
30  
31  
// put func {}'s returning a string in there
32  
static void makeGenerators(L<Gen> l, final L<S> log) {
33  
  gen(l, solverID, func {
34  
    //print("Hotwiring");
35  
    O c = hotwireCached(solverID);
36  
    //print("Calling " + c);
37  
    S s = cast call(c, "calc", log);
38  
    //print("=> " + s);
39  
    ret s;
40  
  });
41  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1003604
Snippet name: Execute solving command
Eternal ID of this version: #1003604/1
Text MD5: 827bc1672751bfbf4e6b8b90a35e68bb
Transpilation MD5: a7ba27768ddc7f928cdf672762fe9015
Author: stefan
Category: javax / talking robots
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-07-24 20:25:29
Source code size: 1117 bytes / 41 lines
Pitched / IR pitched: No / No
Views / Downloads: 623 / 695
Referenced in: [show references]