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).

!7

static int points;
static ImageSurface is;
static int w = 500, h = 500;
static int rw = 50, rh = 50, border = 10;
static int x1, y1;

p-substance {
  nextImage();
}

svoid nextImage {
  RGBImage img = rgbImage(Color.white, w, h);
  x1 = random(border, w-rw-border);
  y1 = random(border, h-rh-border);
  rgbFillRect(img, x1, y1, rw, rh, Color.red);
  bool first = is == null;
  is = showImage(is, img);
  if (first) {
    onLeftClick(is, voidfunc(Pt p) {
      if (new Rect(x1, y1, rw, rh).contains(p)) {
        ++points;
        print("Points: " + points);
        nextImage();
      }
    });
    disableImageSurfaceSelector(is);
  }
}

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: 530 / 659
Referenced in: [show references]