Warning: session_start(): open(/var/lib/php/sessions/sess_2688gv55qmraqksbb9dp7l0bc2, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!7#
!include #1006891 // Click AI Include
p { pGame(); }
extend AI {
Rect leftRect() { ret main.leftRect(image); }
Rect rightRect() { ret main.rightRect(image); }
L clickLeft() { ret submit(leftRect()); }
L clickRight() { ret submit(rightRect()); }
L clickLeftIf(bool b) { ret b ? clickLeft() : clickRight(); }
L clickRightIf(bool b) { ret b ? clickRight() : clickLeft(); }
RGBImage leftImage() { ret image.clip(leftRect()); }
RGBImage rightImage() { ret image.clip(rightRect()); }
}
static int singleImageWidth(RGBImage img) { ret (img.w()-spacing)/2; }
static Rect leftRect(RGBImage img) {
int iw = singleImageWidth(img);
ret new Rect(0, 0, iw, h);
}
static Rect rightRect(RGBImage img) {
int iw = singleImageWidth(img);
ret new Rect(iw+spacing, 0, iw, h);
}
//////////////////////////////////////
// Test AIs. Just add your own here //
//////////////////////////////////////
AI > ClickOnBrighterImage {
void go {
clickLeftIf(rgbAverageBrightness(leftImage()) > rgbAverageBrightness(rightImage()));
}
}
svoid nextImage {
instruction = "Click on the brighter image";
RGBImage img = rgbImage(0xeef3e6, w*2+spacing, h);
double l = random(10)/10.0, r = random(10)/10.0;
Rect lr = leftRect(img), rr = rightRect(img);
rgbFill(img, lr, new RGB(l));
rgbFill(img, rr, new RGB(r));
solution = l > r ? ll(lr) : l == r ? ll(lr, rr) : ll(rr);
main.img = img;
if (aiMode) ret; // occasional updates only when AI is running
showTheImage();
}