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

50
LINES

< > BotCompany Repo | #1003357 // Test Strict Mode (WORKS)

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

Libraryless. Click here for Pure Java version (2401L/17K/56K).

!752

static OccTree<E> tree;

!include #1003370 // DialogBot

sclass StrictBot extends DialogBot {
  *(OccTree<E> node) { super(node); }
  
  bool matchE(E a, E b) {
    ret eq(a, b); // strict!
  }  
}

p {
  L<L<E>> poems = parsePoems(splitAtEmptyLines([[
    Usr: Yes
    Bot: ok yes
    [good]
    
    Usr: No
    Bot: ok no
    [good]
    
    Usr: No
    Bot: ok yes
    [bad]
    
    Usr: Yes
    Bot: ok no
    [bad]
  ]]));
  
  print("Got " + n(l(poems), "dialog") + ".");
  psl(poems);
  
  tree = poems2occTree(poems);
  print(asciiHeading("Occurrence Tree"));
  printOccTree(tree);
  
  check("Usr: Yes", "Bot: ok yes");
  check("Usr: No", "Bot: ok no");
  check("Usr: yes", "fail"); // we are very strict!

  print("OK");
}

svoid check(S in, S out) {
  checkBot(new StrictBot(tree), in, out);
}

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: #1003357
Snippet name: Test Strict Mode (WORKS)
Eternal ID of this version: #1003357/1
Text MD5: f56ec50e9a9d9aa60c61c745e8bb4f72
Transpilation MD5: 5df5307a3e1d00fdc7d8ecfc7dc14990
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-06-25 23:32:15
Source code size: 861 bytes / 50 lines
Pitched / IR pitched: No / No
Views / Downloads: 638 / 688
Referenced in: [show references]