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

36
LINES

< > BotCompany Repo | #1006083 // Find Chess Board 2 [v3, test case as class]

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

Libraryless. Click here for Pure Java version (4101L/28K/96K).

1  
!752
2  
3  
sclass TestCase {
4  
  BufferedImage screen;
5  
  Rect boardRect;
6  
  RGBImage board;
7  
  int boardW, boardH;
8  
  
9  
  *() {
10  
    screen = loadBufferedImage("#1006074");
11  
    boardRect = pointRect(194, 179, 501, 485);
12  
    board = new RGBImage(screen).clip(boardRect);
13  
    boardW = board.w();
14  
    boardH = board.h();
15  
  }
16  
  
17  
  Rect square(int x, int y) {
18  
    ret pointsRect(
19  
      boardW*x/8, boardH*y/8,
20  
      boardW*(x+1)/8, boardH*(y+1)/8);
21  
  }
22  
23  
  void showBoard() {
24  
    new L<RGBImage> imgs;
25  
    for y to 8: {
26  
      new L<Rect> l;
27  
      for x to 8: l.add(square(x, y));
28  
      imgs.add(mergeImagePartsHorizontally(board, l));
29  
    }
30  
    showImage(mergeImagesVertically(imgs));
31  
  }
32  
}
33  
34  
p {
35  
  new TestCase().showBoard();
36  
}

Author comment

Began life as a copy of #1006082

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1006083
Snippet name: Find Chess Board 2 [v3, test case as class]
Eternal ID of this version: #1006083/1
Text MD5: 4bd637197178cccac1189a1fdaf3c21e
Transpilation MD5: c09e8ecaf188af6052c5702653a8313c
Author: stefan
Category: javax / ocr
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-12-17 14:08:26
Source code size: 746 bytes / 36 lines
Pitched / IR pitched: No / No
Views / Downloads: 488 / 517
Referenced in: [show references]