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

26
LINES

< > BotCompany Repo | #1021187 // Year Calc Spike (find, check and generalize equation in script, OK)

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

Download Jar. Libraryless. Click here for Pure Java version (7554L/54K).

1  
!7
2  
3  
sS text = [[
4  
  i started 5 years ago
5  
  current year is 2019
6  
  2019-5 = 2014
7  
  i started in 2014
8  
]];
9  
10  
p-exp {
11  
  S text, SS map = unpair replaceNumbersWithABCDollarVars(main.text);
12  
  map = reverseMap(map);
13  
  print(text);
14  
  printStruct(map);
15  
  new Matches m;
16  
  for (S s : tlft(text))
17  
    if (jmatch("*-* = *", s, m)) pcall {
18  
      print(s);
19  
      S a = getOrKeep(map, $1), b = getOrKeep(map, $2), c = getOrKeep(map, $3);
20  
      print(a + " - " + b + " = " + c);
21  
      if (eq(minus(bigint(a), bigint(b)), bigint(c))) {
22  
        print("  correct!");
23  
        print("  so: " + $3 + " = " + $1 + " - " + $2);
24  
      }
25  
    }
26  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1021187
Snippet name: Year Calc Spike (find, check and generalize equation in script, OK)
Eternal ID of this version: #1021187/8
Text MD5: 6947e9b81dc2f79c976b3c794e263521
Transpilation MD5: 43739fd3897eaf2e9bc9f283832c183b
Author: stefan
Category: javax
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-02-02 15:37:26
Source code size: 643 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 237 / 668
Version history: 7 change(s)
Referenced in: [show references]