public class AI
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
AI.Move
This subclass represents a Move
|
| Constructor and Description |
|---|
AI() |
| Modifier and Type | Method and Description |
|---|---|
static AI.Move |
alphabeta(int depth,
int alpha,
int beta,
AI.Move curMove,
int player)
Implements MinMax algorithm with alpha beta pruning
|
static boolean |
compMove()
Generates move for computer.
|
static boolean |
kingSafe(int kingColor)
Determine if the King is safe
|
static void |
main(java.lang.String[] args)
Main function to start the game
|
static boolean |
makeMove(int iniPos,
int finPos,
int captured)
Making the move on the board
|
static int |
movePiece(int iniPos,
int finPos,
int captured)
Move a piece on board
|
static java.util.ArrayList<AI.Move> |
posMovesBishop(int pos,
boolean moved) |
static java.util.ArrayList<AI.Move> |
posMovesKing(int pos,
boolean moved)
Possible moves for king
|
static java.util.ArrayList<AI.Move> |
posMovesKnight(int pos,
boolean moved) |
static java.util.ArrayList<AI.Move> |
posMovesPawn(int pos,
boolean moved) |
static java.util.ArrayList<AI.Move> |
posMovesQueen(int pos,
boolean moved) |
static java.util.ArrayList<AI.Move> |
posMovesRook(int pos,
boolean moved) |
static java.util.List<AI.Move> |
possibleMoves(int index)
Generates all possible moves for current board.
|
public static void main(java.lang.String[] args)
args - public static int movePiece(int iniPos,
int finPos,
int captured)
iniPos - finPos - captured - public static boolean makeMove(int iniPos,
int finPos,
int captured)
iniPos - finPos - captured - public static java.util.List<AI.Move> possibleMoves(int index)
index - - 0 if for the whole board, else index of piece)public static java.util.ArrayList<AI.Move> posMovesKing(int pos, boolean moved)
pos - moved - public static java.util.ArrayList<AI.Move> posMovesQueen(int pos, boolean moved)
public static java.util.ArrayList<AI.Move> posMovesRook(int pos, boolean moved)
public static java.util.ArrayList<AI.Move> posMovesBishop(int pos, boolean moved)
public static java.util.ArrayList<AI.Move> posMovesKnight(int pos, boolean moved)
public static java.util.ArrayList<AI.Move> posMovesPawn(int pos, boolean moved)
public static boolean kingSafe(int kingColor)
kingColor- - color of the king in referencepublic static boolean compMove()
public static AI.Move alphabeta(int depth, int alpha, int beta, AI.Move curMove, int player)
depth - - depth of treealpha - - value Default: INTEGER_MINbeta - - value Default: INTEGER_MAXcurMove - - the current moveplayer - - the current player