Uses 3874K of libraries. Click here for Pure Java version (9312L/67K/233K).
1 | !7 |
2 | |
3 | !include #1007130 // AI Game Include |
4 | |
5 | p { |
6 | blunderFPS = 1001; // show all blunders |
7 | pGame(); |
8 | } |
9 | |
10 | ////////////////////////////////////// |
11 | // Test AIs. Just add your own here // |
12 | ////////////////////////////////////// |
13 | |
14 | AI > HorizontalAutoSplit { |
15 | ExternalTextAI letterAI; |
16 | static ImageSurface is; |
17 | long lastUpdate; |
18 | |
19 | *() { |
20 | loading { letterAI = loadWinnerTextAI(#1007131); } |
21 | setOpt(letterAI.ai, lax := true); |
22 | } |
23 | |
24 | void go { |
25 | horizontalAutoSplit2_threshold = 0.3f; |
26 | L<BWImage> letters = horizontalAutoSplitToImages(new BWImage(image())); |
27 | new StringBuilder buf; |
28 | for (BWImage img : letters) |
29 | buf.append(letterAI.call(img.getBufferedImage())); |
30 | if (!submitCorrectly(str(buf))) { |
31 | //if (sysNow() > lastUpdate+500) { |
32 | lastUpdate = sysNow(); |
33 | is = showZoomedImage_centered(is, "Horizontal Split", mergeBWImagesHorizontally(letters).toRGB()); |
34 | } |
35 | } |
36 | } |
37 | |
38 | AI > TryAllSplits { |
39 | ExternalTextAI letterAI; |
40 | static ImageSurface is; |
41 | |
42 | *() { |
43 | loading { letterAI = loadWinnerTextAI(#1007131); } |
44 | setOpt(letterAI.ai, lax := true); |
45 | } |
46 | |
47 | void go { |
48 | int w = w(), mid = w/2; |
49 | BWImage bw = bwImage(); |
50 | Best<Pair<S, L<Rect>>> best = new Best; |
51 | for (int splitPoint = 1; splitPoint < w; splitPoint++) { |
52 | Rect l = bwAutoCropClip(bw, new Rect(0, 0, splitPoint, h())); |
53 | Rect r = bwAutoCropClip(bw, new Rect(splitPoint, 0, w-splitPoint, h())); |
54 | S cl = letterAI.call(bw.clip(l).getBufferedImage()); |
55 | float confidence = getFloat(letterAI.ai, "confidence"); |
56 | S cr = letterAI.call(bw.clip(r).getBufferedImage()); |
57 | confidence += getFloat(letterAI.ai, "confidence"); |
58 | best.put(pair(cl + cr, ll(l, r)), confidence); |
59 | } |
60 | if (!submitCorrectly(best.get().a)) |
61 | is = showZoomedImage_centered(is, "Best Horizontal Split", mergeImagePartsHorizontally(image(), best.get().b)); |
62 | } |
63 | } |
64 | |
65 | ////////////////// |
66 | // PUZZLE MAKER // |
67 | ////////////////// |
68 | |
69 | static Puzzle makePuzzle() { |
70 | S text = randomID(2); |
71 | ret new Puzzle("Enter the lowercase text you see:", renderSourceCode_1(text), text); |
72 | } |
Began life as a copy of #1007131
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1007132 |
Snippet name: | A. I. Game 6.2 / Recognize 2 Letters [solved 95%] |
Eternal ID of this version: | #1007132/24 |
Text MD5: | fd248761adac3c49d0b79655f9e3f08e |
Transpilation MD5: | 78a56d7ca73cd739e3cd24c760f3c7ab |
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 15:00:43 |
Source code size: | 2134 bytes / 72 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 576 / 777 |
Version history: | 23 change(s) |
Referenced in: | [show references] |