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

27
LINES

< > BotCompany Repo | #1005153 // optimizeLastLine (dev.)

JavaX fragment (include)

static abstract class o_KnowingSolver {
  abstract void solve(L<Para> examples, Para target);
}

static void optimizeLastLine(L<Para> paras, O solver) {
  int score = 0;
  for (Para p : paras) {
    S method = optimizeLastLine(paras, p);
    if (notNull(method)) {
      print(p.index + " = " + method);
      ++score;
    }
  }
      
  print("Successfully calculated last lines: " + score + " of " + l(paras));
}

// returns calculation method if pivot could be calculated from other paragraphs
static S optimizeLastLine(L<Para> all, Para pivot) {
  L<Para> rest = listMinus(all, pivot);
  Para shortened = new Para(pivot.index, dropLastLine(pivot.text));
  ret optimizeLastLine_solve(rest, shortened);
}

optimizeLastLine_solve(L<Para> examples, Para target) {
  S lastLine = lastLine(pivot.text);
}

Author comment

Began life as a copy of #1005116

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: #1005153
Snippet name: optimizeLastLine (dev.)
Eternal ID of this version: #1005153/1
Text MD5: a8661696ff39975b843f9f9355238425
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-10-17 01:50:21
Source code size: 830 bytes / 27 lines
Pitched / IR pitched: No / No
Views / Downloads: 379 / 387
Referenced in: [show references]