// Path: src/main/java/it/paspiz85/nanobot/platform/Platform.java
// public interface Platform {
// 
//     Size GAME_SIZE = new Size(860, 720 - 47);
// 
//     static Platform instance() {
//         return PlatformResolver.instance().get();
//     }
// 
//     boolean compareColor(Color c1, Color c2, int var);
// 
//     Size getExpectedSize();
// 
//     BufferedImage getSubimage(BufferedImage image, Area area);
// 
//     BufferedImage getSubimage(BufferedImage image, Point p1, Point p2);
// 
//     /**
//      * Check emulator windows and setup the platform to working with that.
//      *
//      * @throws BotConfigurationException
//      */
//     void init() throws BotConfigurationException;
// 
//     /**
//      * Check emulator windows and setup the platform to working with that.
//      *
//      * @param autoAdjustResolution
//      *            supplier to decide if auto adjust game resolution.
//      * @throws BotConfigurationException
//      */
//     void init(BooleanSupplier autoAdjustResolution) throws BotConfigurationException;
// 
//     void keyPress(int keyCode, boolean shifted) throws InterruptedException;
// 
//     /**
//      * Do a left click on game. Randomize is true.
//      *
//      * @param point
//      *            coordinates of click.
//      * @throws InterruptedException
//      */
//     void leftClick(Point point) throws InterruptedException;
// 
//     /**
//      * Do a left click on game.
//      *
//      * @param point
//      *            coordinates of click.
//      * @param randomize
//      * @throws InterruptedException
//      */
//     void leftClick(Point point, boolean randomize) throws InterruptedException;
// 
//     boolean matchColoredPoint(Pixel point);
// 
//     File saveImage(BufferedImage img, String... filePathRest);
// 
//     File saveScreenshot(Area area, String... filePathRest);
// 
//     File saveScreenshot(String... filePathRest);
// 
//     BufferedImage screenshot();
// 
//     BufferedImage screenshot(Area area);
// 
//     /**
//      * Sleep random interval between sleepInMs and 2*sleepInMs.
//      *
//      * @param sleepInMs
//      *            minimum sleep time.
//      * @throws InterruptedException
//      *             thread interrupted.
//      */
//     void sleepRandom(int sleepInMs) throws InterruptedException;
// 
//     Point waitForClick() throws InterruptedException;
// 
//     void write(String str) throws InterruptedException;
// 
//     /**
//      * Change game view to max zoom level.
//      *
//      * @throws InterruptedException
//      */
//     void zoomUp() throws InterruptedException;
// }
// 
// Path: src/main/java/it/paspiz85/nanobot/util/Pixel.java
// public class Pixel extends Point {
// 
//     private final Color color;
// 
//     public Pixel(final int x, final int y, final Color color) {
//         super(x, y);
//         if (color == null) {
//             throw new NullPointerException("null color");
//         }
//         this.color = color;
//     }
// 
//     public Color getColor() {
//         return color;
//     }
// }
// 
// Path: src/main/java/it/paspiz85/nanobot/util/Point.java
// public class Point implements Comparable<Point> {
// 
//     private final int x;
// 
//     private final int y;
// 
//     public Point(final int x, final int y) {
//         this.x = x;
//         this.y = y;
//     }
// 
//     @Override
//     public int compareTo(final Point o) {
//         return this.x != o.x ? this.x - o.x : this.y - o.y;
//     }
// 
//     @Override
//     public boolean equals(final Object obj) {
//         if (this == obj) {
//             return true;
//         }
//         if (obj == null) {
//             return false;
//         }
//         if (getClass() != obj.getClass()) {
//             return false;
//         }
//         final Point other = (Point) obj;
//         if (x != other.x) {
//             return false;
//         }
//         if (y != other.y) {
//             return false;
//         }
//         return true;
//     }
// 
//     @Override
//     public int hashCode() {
//         final int prime = 31;
//         int result = 1;
//         result = prime * result + x;
//         result = prime * result + y;
//         return result;
//     }
// 
//     @Override
//     public String toString() {
//         return "[" + x + "," + y + "]";
//     }
// 
//     public int x() {
//         return x;
//     }
// 
//     public int y() {
//         return y;
//     }
// }


import it.paspiz85.nanobot.platform.Platform;
import it.paspiz85.nanobot.util.Pixel;
import it.paspiz85.nanobot.util.Point;
import java.awt.Color;
import java.util.logging.Level;
import java.util.logging.Logger;
package it.paspiz85.nanobot.logic;



/**
 * Logic to check if game disconnected.
 *
 * @author paspiz85
 *
 */
public class DisconnectChecker implements Runnable {

    private static final Pixel UNIT_BLUESTACKS_DC = new Pixel(699, 343, new Color(0x282828));

    private static final Point UNIT_RECONNECT = new Point(435, 400);

    private final Context context;

    private final Logger logger = Logger.getLogger(getClass().getName());

    private final Looper looper;

    private final Thread mainThread;

// Path: src/main/java/it/paspiz85/nanobot/platform/Platform.java
// public interface Platform {
// 
//     Size GAME_SIZE = new Size(860, 720 - 47);
// 
//     static Platform instance() {
//         return PlatformResolver.instance().get();
//     }
// 
//     boolean compareColor(Color c1, Color c2, int var);
// 
//     Size getExpectedSize();
// 
//     BufferedImage getSubimage(BufferedImage image, Area area);
// 
//     BufferedImage getSubimage(BufferedImage image, Point p1, Point p2);
// 
//     /**
//      * Check emulator windows and setup the platform to working with that.
//      *
//      * @throws BotConfigurationException
//      */
//     void init() throws BotConfigurationException;
// 
//     /**
//      * Check emulator windows and setup the platform to working with that.
//      *
//      * @param autoAdjustResolution
//      *            supplier to decide if auto adjust game resolution.
//      * @throws BotConfigurationException
//      */
//     void init(BooleanSupplier autoAdjustResolution) throws BotConfigurationException;
// 
//     void keyPress(int keyCode, boolean shifted) throws InterruptedException;
// 
//     /**
//      * Do a left click on game. Randomize is true.
//      *
//      * @param point
//      *            coordinates of click.
//      * @throws InterruptedException
//      */
//     void leftClick(Point point) throws InterruptedException;
// 
//     /**
//      * Do a left click on game.
//      *
//      * @param point
//      *            coordinates of click.
//      * @param randomize
//      * @throws InterruptedException
//      */
//     void leftClick(Point point, boolean randomize) throws InterruptedException;
// 
//     boolean matchColoredPoint(Pixel point);
// 
//     File saveImage(BufferedImage img, String... filePathRest);
// 
//     File saveScreenshot(Area area, String... filePathRest);
// 
//     File saveScreenshot(String... filePathRest);
// 
//     BufferedImage screenshot();
// 
//     BufferedImage screenshot(Area area);
// 
//     /**
//      * Sleep random interval between sleepInMs and 2*sleepInMs.
//      *
//      * @param sleepInMs
//      *            minimum sleep time.
//      * @throws InterruptedException
//      *             thread interrupted.
//      */
//     void sleepRandom(int sleepInMs) throws InterruptedException;
// 
//     Point waitForClick() throws InterruptedException;
// 
//     void write(String str) throws InterruptedException;
// 
//     /**
//      * Change game view to max zoom level.
//      *
//      * @throws InterruptedException
//      */
//     void zoomUp() throws InterruptedException;
// }
// 
// Path: src/main/java/it/paspiz85/nanobot/util/Pixel.java
// public class Pixel extends Point {
// 
//     private final Color color;
// 
//     public Pixel(final int x, final int y, final Color color) {
//         super(x, y);
//         if (color == null) {
//             throw new NullPointerException("null color");
//         }
//         this.color = color;
//     }
// 
//     public Color getColor() {
//         return color;
//     }
// }
// 
// Path: src/main/java/it/paspiz85/nanobot/util/Point.java
// public class Point implements Comparable<Point> {
// 
//     private final int x;
// 
//     private final int y;
// 
//     public Point(final int x, final int y) {
//         this.x = x;
//         this.y = y;
//     }
// 
//     @Override
//     public int compareTo(final Point o) {
//         return this.x != o.x ? this.x - o.x : this.y - o.y;
//     }
// 
//     @Override
//     public boolean equals(final Object obj) {
//         if (this == obj) {
//             return true;
//         }
//         if (obj == null) {
//             return false;
//         }
//         if (getClass() != obj.getClass()) {
//             return false;
//         }
//         final Point other = (Point) obj;
//         if (x != other.x) {
//             return false;
//         }
//         if (y != other.y) {
//             return false;
//         }
//         return true;
//     }
// 
//     @Override
//     public int hashCode() {
//         final int prime = 31;
//         int result = 1;
//         result = prime * result + x;
//         result = prime * result + y;
//         return result;
//     }
// 
//     @Override
//     public String toString() {
//         return "[" + x + "," + y + "]";
//     }
// 
//     public int x() {
//         return x;
//     }
// 
//     public int y() {
//         return y;
//     }
// }


// Path: src/main/java/it/paspiz85/nanobot/logic/DisconnectChecker.java
import it.paspiz85.nanobot.platform.Platform;
import it.paspiz85.nanobot.util.Pixel;
import it.paspiz85.nanobot.util.Point;
import java.awt.Color;
import java.util.logging.Level;
import java.util.logging.Logger;

package it.paspiz85.nanobot.logic;



/**
 * Logic to check if game disconnected.
 *
 * @author paspiz85
 *
 */
public class DisconnectChecker implements Runnable {

    private static final Pixel UNIT_BLUESTACKS_DC = new Pixel(699, 343, new Color(0x282828));

    private static final Point UNIT_RECONNECT = new Point(435, 400);

    private final Context context;

    private final Logger logger = Logger.getLogger(getClass().getName());

    private final Looper looper;

    private final Thread mainThread;

    private final Platform platform = Platform.instance();