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

32
LINES

< > BotCompany Repo | #1004295 // More Logic [Chemists]

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

Libraryless. Click here for Pure Java version (2574L/17K/59K).

!759

p {
  // load log

  L<S> log = scanEventLogForText("#1004032", "chemists");
  print(indent("> ", trim(joinLines(log))) + "\n");
  genLog_set(log);
  
  // infer stuff

  gRepeat("inferStuff");

  // answer questions
  
  for (Matches m : gJMatch("if * then check(*)"))
    for (S statement : mapReplaceVars(m.unq(1), gSat(m.unq(0))))
      gAdd(nempty(gSat(statement)) ? "yes, " + statement : "no @ " + quote(statement));

  // check our performance!

  for (S s : gWants())
    if (nempty(gJMatch(s)))
      print("Success! Found statement: " + s);
    else
      print("Statement " + quote(s) + " not found...");
}

svoid inferStuff {
  for (Matches m : gJMatch("if * and * then *"))
    gAddAll(mapReplaceVars(m.unq(2), gSatAnd(m.unq(0), m.unq(1))));
}

Author comment

Began life as a copy of #1004284

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: #1004295
Snippet name: More Logic [Chemists]
Eternal ID of this version: #1004295/1
Text MD5: 91ce3c7335355e7e6379ca82ab1b6cb5
Transpilation MD5: 6921c8cc4e19af01e50ad09f2362cafd
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-08-14 01:45:46
Source code size: 793 bytes / 32 lines
Pitched / IR pitched: No / No
Views / Downloads: 662 / 738
Referenced in: [show references]