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

!752

!include #1003606 // GenTesting

static int n = 4;
static S solverID = "#1003632";

p {
  // Just call another program's function... JavaX makes it possible!
  O mainProg = hotwire("#1003582");
  L<S> log = cast call(mainProg, "loadLog");
  printStructureLines(log);
  
  // assume command is in last line...
  log = dropLast(log);
  
  // shrink to number of wanted entries
  log = getLast(log, n);
  
  GenTesting test = new GenTesting(voidfunc(L<Gen> gens, L<S> log) { makeGenerators(gens, log); });
  test.comparison = "match";
  int score = test.scoreGenerator(log, solverID);
  if (score > 0) {
    print("Yay! Solved! (" + score + "/" + n + ")");
    print("Recommending...");
    callOpt(mainProg, "recommendSolver", solverID);
  } else
    print("Not solved...");
}

// put func {}'s returning a string in there
static void makeGenerators(L<Gen> l, final L<S> log) {
  gen(l, solverID, func {
    //print("Hotwiring");
    O c = hotwireCached(solverID);
    //print("Calling " + c);
    S s = cast call(c, "calc", log);
    //print("=> " + s);
    ret s;
  });
}

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