// Path: app/src/main/java/com/tos_bot/ConfigData.java
// public class ConfigData {
// 	public static String Serverurl;
// 	public static int eightd = 0;   	// 0 is no eight direction
// 	public static int deep = 30;		// max move
// 	public static int waitForStageChageTimeSec = 12;
// 	public static String DeviceName = "";
// 	public static Integer StyleName = R.id.Vary_color_Single;
// 	public static String TempDir = "";
// 	public static Thread solverThread = null;
// 	public static String maxCombo = "0";		//0 is no limit
// 	public static String gap = "70";			//the sleep time between two touch command
// 	public static int timeOut = 10;
// 	//For TouchEvent
// 	public static String touchEventNum;
// 	public static String posXId;
// 	public static String posYId;
// 	public static String posXMax;
// 	public static String posYMax;
// 	public static String trackingId;
// 	public static String pressureId;
// 	public static String trackingMax;
// 	public static String pressureMax;
// 	public static String oneBallMove;
// 	public static String startPosX;
// 	public static String startPosY;
// 	//For Image Setting
// 	public static int oneOrbWitdh=0;
// 	public static int boardStartX=0;
// 	public static int boardStartY=0;
// 	
// 	
// 	public static int MaxOrbType=7;
// 	public static LinkedHashMap<String, String> baseOrbHash = null;
// 	
// 	/**
// 	 * get config data from SharedPreferences
// 	 */
// 	static public void setConfig(SharedPreferences settings ){
// 		ConfigData.Serverurl = settings.getString("Serverurl", "http://tbserver.ap01.aws.af.cm/");
// 		ConfigData.deep = settings.getInt("deep", 30);
// 		ConfigData.maxCombo = settings.getString("maxCombo", "0");
// 		ConfigData.gap = settings.getString("gap","70");
// 		ConfigData.DeviceName =  settings.getString("DeviceName","Auto");
// 		ConfigData.touchEventNum = settings.getString("touchEventNum","");
// 		ConfigData.posXId = settings.getString("posXId","");
// 		ConfigData.posYId = settings.getString("posYId","");
// 		ConfigData.posXMax = settings.getString("posXMax","");
// 		ConfigData.posYMax = settings.getString("posYMax","");
// 		ConfigData.trackingId = settings.getString("trackingId","");
// 		ConfigData.pressureId = settings.getString("pressureId","");
// 		ConfigData.trackingMax = settings.getString("trackingMax","");
// 		ConfigData.pressureMax = settings.getString("pressureMax","");
// 		ConfigData.oneBallMove = settings.getString("oneBallMove","");
// 		ConfigData.startPosX = settings.getString("startPosX","");
// 		ConfigData.startPosY = settings.getString("startPosY","");
// 		
// 		//For Image
// 		ConfigData.oneOrbWitdh = settings.getInt("oneOrbWitdh", 0);
// 		ConfigData.boardStartX = settings.getInt("boardStartX", 0);
// 		ConfigData.boardStartY = settings.getInt("boardStartY", 0);
// 		
// 
// 	}
// 	
// }
// 
// Path: app/src/main/java/com/tos_bot/puzzleslove/solution.java
// @SuppressLint("NewApi")
// public class solution implements Comparator<solution> {
// 	public int[][] board;
// 	public int[][] currentboard;
// 	public pos cursor;
// 	public pos initcursor;
// 	public ArrayList<Integer> path;
// 	public boolean is_done;
// 	public ArrayList<matchPair> matches;
// 	public solution(int[][] inboard,pos c,pos ic,ArrayList<Integer> p,boolean done,ArrayList<matchPair> m){
// 		board = new int[5][6];
// 		for(int i =0;i<5;i++)
// 			for(int j=0;j<6;j++)
// 				board[i][j] = inboard[i][j];
// 		cursor = c;
// 		initcursor = ic;
// 		path = new ArrayList<Integer>();
// 		path.addAll(p);
// 		is_done = done;
// 		matches = m;
// 	}
// 	public solution(){
// 		
// 	}
//     public int compare(solution a, solution b) {
//         return Integer.signum(a.matches.size() - b.matches.size());
//     }
//     public void setCB(int[][] b){
//     	currentboard = new int[5][6];
// 		for(int i =0;i<5;i++)
// 			for(int j=0;j<6;j++)
// 				currentboard[i][j] = b[i][j];
//     }
//  
// 	
// }


import java.io.IOException;
import java.io.OutputStream;
import java.util.Vector;
import android.os.SystemClock;
import com.tos_bot.ConfigData;
import com.tos_bot.puzzleslove.solution;
		ret.addAll(touchDown(inix, iniy));

		int nowx = inix;
		int nowy = iniy;
		// step 2. add path
		for (Integer p : s.path) {
			touchpos pos = changePathToPos(p);
			int passx = nowx;
			int passy = nowy;
			nowx += pos.x;
			nowy += pos.y;
			ret.addAll(touchMove(passx, passy, nowx, nowy, 1));
		}
		ret.addAll(touchUp());

		return ret;
	}

	public Vector<String> getCommandByPath(int inith, int initw,
			String[] pathsetp) {

		Vector<String> ret = new Vector<String>();
		// step 1. get init
		int inix = _inix + initw * _ballgap;
		int iniy = _iniy + inith * _ballgap;
		ret.addAll(touchDown(inix, iniy));
		SystemClock.sleep(100);
		int nowx = inix;
		int nowy = iniy;
		// step 2. add path
// Path: app/src/main/java/com/tos_bot/ConfigData.java
// public class ConfigData {
// 	public static String Serverurl;
// 	public static int eightd = 0;   	// 0 is no eight direction
// 	public static int deep = 30;		// max move
// 	public static int waitForStageChageTimeSec = 12;
// 	public static String DeviceName = "";
// 	public static Integer StyleName = R.id.Vary_color_Single;
// 	public static String TempDir = "";
// 	public static Thread solverThread = null;
// 	public static String maxCombo = "0";		//0 is no limit
// 	public static String gap = "70";			//the sleep time between two touch command
// 	public static int timeOut = 10;
// 	//For TouchEvent
// 	public static String touchEventNum;
// 	public static String posXId;
// 	public static String posYId;
// 	public static String posXMax;
// 	public static String posYMax;
// 	public static String trackingId;
// 	public static String pressureId;
// 	public static String trackingMax;
// 	public static String pressureMax;
// 	public static String oneBallMove;
// 	public static String startPosX;
// 	public static String startPosY;
// 	//For Image Setting
// 	public static int oneOrbWitdh=0;
// 	public static int boardStartX=0;
// 	public static int boardStartY=0;
// 	
// 	
// 	public static int MaxOrbType=7;
// 	public static LinkedHashMap<String, String> baseOrbHash = null;
// 	
// 	/**
// 	 * get config data from SharedPreferences
// 	 */
// 	static public void setConfig(SharedPreferences settings ){
// 		ConfigData.Serverurl = settings.getString("Serverurl", "http://tbserver.ap01.aws.af.cm/");
// 		ConfigData.deep = settings.getInt("deep", 30);
// 		ConfigData.maxCombo = settings.getString("maxCombo", "0");
// 		ConfigData.gap = settings.getString("gap","70");
// 		ConfigData.DeviceName =  settings.getString("DeviceName","Auto");
// 		ConfigData.touchEventNum = settings.getString("touchEventNum","");
// 		ConfigData.posXId = settings.getString("posXId","");
// 		ConfigData.posYId = settings.getString("posYId","");
// 		ConfigData.posXMax = settings.getString("posXMax","");
// 		ConfigData.posYMax = settings.getString("posYMax","");
// 		ConfigData.trackingId = settings.getString("trackingId","");
// 		ConfigData.pressureId = settings.getString("pressureId","");
// 		ConfigData.trackingMax = settings.getString("trackingMax","");
// 		ConfigData.pressureMax = settings.getString("pressureMax","");
// 		ConfigData.oneBallMove = settings.getString("oneBallMove","");
// 		ConfigData.startPosX = settings.getString("startPosX","");
// 		ConfigData.startPosY = settings.getString("startPosY","");
// 		
// 		//For Image
// 		ConfigData.oneOrbWitdh = settings.getInt("oneOrbWitdh", 0);
// 		ConfigData.boardStartX = settings.getInt("boardStartX", 0);
// 		ConfigData.boardStartY = settings.getInt("boardStartY", 0);
// 		
// 
// 	}
// 	
// }
// 
// Path: app/src/main/java/com/tos_bot/puzzleslove/solution.java
// @SuppressLint("NewApi")
// public class solution implements Comparator<solution> {
// 	public int[][] board;
// 	public int[][] currentboard;
// 	public pos cursor;
// 	public pos initcursor;
// 	public ArrayList<Integer> path;
// 	public boolean is_done;
// 	public ArrayList<matchPair> matches;
// 	public solution(int[][] inboard,pos c,pos ic,ArrayList<Integer> p,boolean done,ArrayList<matchPair> m){
// 		board = new int[5][6];
// 		for(int i =0;i<5;i++)
// 			for(int j=0;j<6;j++)
// 				board[i][j] = inboard[i][j];
// 		cursor = c;
// 		initcursor = ic;
// 		path = new ArrayList<Integer>();
// 		path.addAll(p);
// 		is_done = done;
// 		matches = m;
// 	}
// 	public solution(){
// 		
// 	}
//     public int compare(solution a, solution b) {
//         return Integer.signum(a.matches.size() - b.matches.size());
//     }
//     public void setCB(int[][] b){
//     	currentboard = new int[5][6];
// 		for(int i =0;i<5;i++)
// 			for(int j=0;j<6;j++)
// 				currentboard[i][j] = b[i][j];
//     }
//  
// 	
// }


// Path: app/src/main/java/com/tos_bot/touchservice/AbstractTouchService.java
import java.io.IOException;
import java.io.OutputStream;
import java.util.Vector;
import android.os.SystemClock;
import com.tos_bot.ConfigData;
import com.tos_bot.puzzleslove.solution;

		ret.addAll(touchDown(inix, iniy));

		int nowx = inix;
		int nowy = iniy;
		// step 2. add path
		for (Integer p : s.path) {
			touchpos pos = changePathToPos(p);
			int passx = nowx;
			int passy = nowy;
			nowx += pos.x;
			nowy += pos.y;
			ret.addAll(touchMove(passx, passy, nowx, nowy, 1));
		}
		ret.addAll(touchUp());

		return ret;
	}

	public Vector<String> getCommandByPath(int inith, int initw,
			String[] pathsetp) {

		Vector<String> ret = new Vector<String>();
		// step 1. get init
		int inix = _inix + initw * _ballgap;
		int iniy = _iniy + inith * _ballgap;
		ret.addAll(touchDown(inix, iniy));
		SystemClock.sleep(100);
		int nowx = inix;
		int nowy = iniy;
		// step 2. add path
		int gap = Integer.parseInt(ConfigData.gap);