get("#451") -- getIcons (grid size=3) get("#388") -- rect functions fw, fh = 7, 15 -- font size function findLeftBorder() for x = 0, w-1 do local nwhite = 0 for y = 0, fh*2-1 do if img.getInt(x, y) == 0xFFFFFF then nwhite = nwhite+1 end end if nwhite >= fh-1 then -- one row might not be white leftBorder = x return end print("x", x, "nwhite", nwhite) end error("left border not found") end w, h = img.width, img.height function findGrid() findLeftBorder() getIcons() r = icons["00f8a328"] or icons["00919df2"] or icons["002afe9a"] -- the latter is in black if r == nil then error "package statement not found" end r = stringtorect(r) --return r.x..", "..r.y sx, sy = r.x, r.y-2 sx, sy = (sx-leftBorder) % fw + leftBorder, sy%fh end
Began life as a copy of #447
test run test run with input download show line numbers
Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #452 |
Snippet name: | Java grid locator (include) |
Eternal ID of this version: | #452/1 |
Text MD5: | f7b9ded8aba83cbb0fef3c38daf2507d |
Author: | stefan |
Category: | image recognition |
Type: | Lua code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-02-13 00:50:55 |
Source code size: | 863 bytes / 38 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 1035 / 211 |
Referenced in: | #453 - Java character reference maker #455 - Java source recognizer #456 - Java character reference maker (non-bold) #3000189 - Answer for stefanreich(>> t bla) #3000382 - Answer for ferdie (>> t = 1, f = 0) #3000383 - Answer for funkoverflow (>> t=1, f=0 okay) |