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

30
LINES

< > BotCompany Repo | #1006656 // A.I. Game

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

Libraryless. Click here for Pure Java version (5652L/40K/138K).

1  
!7
2  
3  
static int points;
4  
static ImageSurface is;
5  
static int w = 500, h = 500;
6  
static int rw = 50, rh = 50, border = 10;
7  
static int x1, y1;
8  
9  
p-substance {
10  
  nextImage();
11  
}
12  
13  
svoid nextImage {
14  
  RGBImage img = rgbImage(Color.white, w, h);
15  
  x1 = random(border, w-rw-border);
16  
  y1 = random(border, h-rh-border);
17  
  rgbFillRect(img, x1, y1, rw, rh, Color.red);
18  
  bool first = is == null;
19  
  is = showImage(is, img);
20  
  if (first) {
21  
    onLeftClick(is, voidfunc(Pt p) {
22  
      if (new Rect(x1, y1, rw, rh).contains(p)) {
23  
        ++points;
24  
        print("Points: " + points);
25  
        nextImage();
26  
      }
27  
    });
28  
    disableImageSurfaceSelector(is);
29  
  }
30  
}

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: #1006656
Snippet name: A.I. Game
Eternal ID of this version: #1006656/1
Text MD5: 62937ff75c3fafad838c4e7120bfecbd
Transpilation MD5: b25671a5d6807a3c6d9aacef0e594a54
Author: stefan
Category: javax / gui
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-01-27 04:13:08
Source code size: 671 bytes / 30 lines
Pitched / IR pitched: No / No
Views / Downloads: 531 / 660
Referenced in: [show references]