Uses 3874K of libraries. Click here for Pure Java version (8664L/61K/219K).
1 | !7 |
2 | |
3 | !include #1007130 // AI Game Include |
4 | |
5 | p { |
6 | showBlunderWindow = false; |
7 | pGame(); |
8 | } |
9 | |
10 | ////////////////////////////////////// |
11 | // Test AIs. Just add your own here // |
12 | ////////////////////////////////////// |
13 | |
14 | AI > AI_BWImageCat { |
15 | new BWImageCategorizer cat; |
16 | new L<S> texts; |
17 | static ImageSurface is; |
18 | bool lax; |
19 | float confidence; |
20 | |
21 | *() { |
22 | cat.allowedDistance = 0.03f; |
23 | } |
24 | |
25 | void go { |
26 | BWImage img = autoCroppedBWImage(bwImage()); |
27 | if (lax) { // mode for users of this AI (e.g. AI Game 6.2) |
28 | Pair<Int, Float> x = cat.locateLax(img); |
29 | confidence = x.b; |
30 | submit(get(texts, x.a)); |
31 | ret; |
32 | } |
33 | int i = cat.addImage(img); |
34 | S guess = get(texts, i); |
35 | S solution = submit(guess); |
36 | if (nempty(solution) && empty(guess)) { |
37 | listSet(texts, i, solution); |
38 | bool first = is == null; |
39 | is = showImage(is, shortClassName(this) + ": " + join(texts), mergeImagesHorizontally(cat.rgbImages())); |
40 | if (first) { |
41 | setFrameWidth(is, 600); |
42 | moveToTopRightCorner(is); |
43 | } |
44 | } |
45 | } |
46 | } |
47 | |
48 | ////////////////// |
49 | // PUZZLE MAKER // |
50 | ////////////////// |
51 | |
52 | static Puzzle makePuzzle() { |
53 | S text = randomID(1); |
54 | ret new Puzzle("Enter the lowercase letter you see:", addRandomSizedBorder(renderSourceCode_1(text)), text); |
55 | } |
Began life as a copy of #1006846
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: | #1007131 |
Snippet name: | A. I. Game 6.1 / Recognize 1 Letter [SOLVED] |
Eternal ID of this version: | #1007131/31 |
Text MD5: | 7545a9c64f5a2f9ced697380b5eb0476 |
Transpilation MD5: | cab944fdbbc6bf1b7d61e72f56aec236 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-03-06 14:43:49 |
Source code size: | 1322 bytes / 55 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 560 / 1107 |
Version history: | 30 change(s) |
Referenced in: | [show references] |