|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectPlayer
PlayerAI
public class PlayerAI
Constructor Summary | |
---|---|
PlayerAI(Board board,
Move move,
int side)
Constructor |
Method Summary | |
---|---|
void |
advance(Player player)
Advance piece. |
void |
attack(Player player)
Tries to capture highest value enemy piece. |
void |
defense(Player player)
If piece in danger move to a safe square. |
void |
doBestMove(Player player)
Performs the best possible move in different situations. |
java.util.ArrayList<java.util.ArrayList<java.lang.Integer>> |
getAllSquaresPossibleToMove(int side)
Get all squares pieces are allowed to move. |
java.util.ArrayList<java.util.ArrayList<java.lang.String>> |
getAllSquaresPossibleToMoveAndPiece(int side)
Returns two arraylists of piece notations and where they can move. |
java.util.ArrayList<java.util.ArrayList<Piece>> |
getPiecesPossibleToCapture(int side)
Get all enemy pieces that can be captured. |
Piece[] |
highestValuePieceAbleToCapture(int side)
Returns an array that contains two cells which first cell contains own piece that can be capture highest value enemy piece and second cell contains highest value enemy piece. |
boolean |
isCheckmate(Player player)
Check if player's King is in checkmate. |
boolean |
isSquareSafe(int x,
int y,
Player player)
check that enemy can't move to selected square on next round. |
java.util.ArrayList<java.util.ArrayList<Piece>> |
piecesAbleToCaptureInValueDescOrder(int side)
Returns an array of enemy pieces that can be captured in value descending order. |
void |
printHighestValuePieceAbleToCapture(int side)
Prints the highest value piece that can be captured and piece that can capture it. |
void |
printPiecesToCaptureAsNotation(int side)
Prints a list of which own piece can capture enemy piece. |
void |
sortPieceArray(Piece[] list,
int length)
Sorts an array of Piece objects in ascending order by value. |
Methods inherited from class Player |
---|
getEnemySide, getSide, isOwnPiece, setSide |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PlayerAI(Board board, Move move, int side)
side
- Method Detail |
---|
public java.util.ArrayList<java.util.ArrayList<java.lang.Integer>> getAllSquaresPossibleToMove(int side)
side
-
public java.util.ArrayList<java.util.ArrayList<java.lang.String>> getAllSquaresPossibleToMoveAndPiece(int side)
side
-
public java.util.ArrayList<java.util.ArrayList<Piece>> getPiecesPossibleToCapture(int side)
side
-
public void printPiecesToCaptureAsNotation(int side)
side
- public Piece[] highestValuePieceAbleToCapture(int side)
side
-
public java.util.ArrayList<java.util.ArrayList<Piece>> piecesAbleToCaptureInValueDescOrder(int side)
side
-
public boolean isCheckmate(Player player)
player
-
public void sortPieceArray(Piece[] list, int length)
list
- length
- public void printHighestValuePieceAbleToCapture(int side)
side
- public void doBestMove(Player player)
public void defense(Player player)
player
- public void attack(Player player)
player
- public boolean isSquareSafe(int x, int y, Player player)
x
- y
- player
-
public void advance(Player player)
player
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |