Tutorial

Here is a example of a bot. That bot go one step forward with the queen, if the queen is on the field

import java.util.ArrayList;
import chessBall.ChessBallAIMove;
import chessBall.ChessBallConstants;
import chessBall.ai.AI;

public class MyAI extends AI {

	// is called before the think method 
	public void reset() {
	}
	
	public String getName() {
		return "My AI";
	}

	@Override
	public ArrayList<ChessBallAIMove> think(int[][] level, final AtMove eAtMove) {
		ArrayList<ChessBallAIMove> move = new ArrayList<ChessBallAIMove>();
		// search the queen
		for (int y = 0; y < level.length; y++) {
			for (int x = 0; x < level[0].length; x++) {
				// find the queen?
				if (((level[y][x] == ChessBallConstants.FIELD_QUEEN_BLACK) && (eAtMove.isBlack())) ||
					((level[y][x] == ChessBallConstants.FIELD_QUEEN_WHITE) && (eAtMove.isWhite()))) {
					// if the queen is white then go one step down, otherwise up
					int add = 1;
					if (level[y][x] == ChessBallConstants.FIELD_QUEEN_BLACK) {
						add = -1;
					}
					// get the goArea
					boolean[][] goArea = canGoArea(level, x, y, eAtMove);
					// if the queen can go to that point then go
					if ((y + add >= 0) && (y + add < level.length) && (goArea[y+add][x])) {
						move.add(new ChessBallAIMove(level[y][x], x, y, x, y + add));
					}
				}
			}
		}
		return move;
	}

}