Uses 911K of libraries. Click here for Pure Java version (6352L/32K).
1 | !7 |
2 | |
3 | cmodule PhilosophyBot2 extends DynPrintLog {
|
4 | transient L unmappedLines = ll("good", "early morning");
|
5 | transient L unmappedQuestions = ll("what is the time", "how do you feel");
|
6 | |
7 | transient S program = [[ |
8 | |
9 | funnyAlgorithm |
10 | |
11 | funnyAlgorithm => proc {
|
12 | while (there are unmapped questions): |
13 | find (an unmapped question) x |
14 | find (an unmapped line) y |
15 | map x to y |
16 | } |
17 | |
18 | ]]; |
19 | |
20 | transient new PhilosophyBot1 bot; |
21 | |
22 | start-thread {
|
23 | bot.program = program; |
24 | bot.addNativePredicate("there are unmapped questions",
|
25 | () -> nempty(unmappedQuestions)); |
26 | bot.addNativePredicate("find (an unmapped question) x",
|
27 | () -> {
|
28 | print("find unmapped question x");
|
29 | if (empty(unmappedQuestions)) false; |
30 | ret litcimap(x := random(unmappedQuestions)); |
31 | }); |
32 | bot.addNativePredicate("find (an unmapped line) z",
|
33 | () -> {
|
34 | print("find unmapped line z");
|
35 | if (empty(unmappedLines)) false; |
36 | ret litcimap(z := random(unmappedLines)); |
37 | }); |
38 | |
39 | bot.run(); |
40 | } |
41 | } |
Began life as a copy of #1025598
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1025605 |
| Snippet name: | Philosophy Bot 2 - match questions and answers [works with a very high chance, but without proper backtracking] |
| Eternal ID of this version: | #1025605/1 |
| Text MD5: | 4cd7d521a2a7e77082597009d4b1045e |
| Transpilation MD5: | 189e238f1028eafe6d42da2217ee8323 |
| Author: | stefan |
| Category: | |
| Type: | JavaX source code (Dynamic Module) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2019-10-07 14:23:43 |
| Source code size: | 1093 bytes / 41 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 549 / 650 |
| Referenced in: | [show references] |