|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.japanesechess.util.PlyBoardFactory
public class PlyBoardFactory
Given a Handicap, previousBoard and current ply, what should the board look like as a packed byte[] array.
| Field Summary | |
|---|---|
private boolean |
black
|
private BoardPackUtil |
bpUtil
|
private ShogiPly |
currentPly
|
private Handicap |
handicap
|
private byte[] |
previousBoard
|
private ShogiPly |
previousPly
|
private boolean |
wasPromoted
|
private boolean |
willPromote
|
| Constructor Summary | |
|---|---|
PlyBoardFactory()
|
|
| Method Summary | |
|---|---|
private int[][] |
capture(int[][] brd,
java.lang.String toSquare)
Only modifies the int[][] if there is a capture that takes place at the toSquare |
private byte[] |
drop(Tokens token,
java.lang.String toSquare)
|
void |
generateAndSetBoard(Handicap handicap,
byte[] previousBoard,
ShogiPly lastPly,
ShogiPly newPly,
boolean black)
Generates the board that this ply creates and passes to the ply for use in board displays. |
private int |
getColumn(int location)
|
private int |
getLocationInt(int x,
java.lang.String yS)
0-80 location of square on board as used by BoardPackUtil. |
private java.lang.String[] |
getLocations(boolean[][] to)
|
private int |
getRowNumber(int location)
|
private byte[] |
moveToken(Tokens token,
java.lang.String toSquare)
|
private byte[] |
moveToken(Tokens token,
java.lang.String toSquare,
int fromCol)
|
private byte[] |
moveToken(Tokens token,
java.lang.String toSquare,
int fromCol,
java.lang.String fromRow)
|
private byte[] |
moveToken(Tokens token,
java.lang.String toSquare,
java.lang.String fromRow)
|
private byte[] |
parseNotation(java.lang.String note)
All the good stuff goes here. |
private java.lang.String |
rowNumber2Letter(int r)
Utility for converting zero based row numbers into their proper characters. |
private byte[] |
tokenCaptures(Tokens token)
Uses previous ply's x2 and y2 as x2 and y2 for this move. |
private byte[] |
tokenCaptures(Tokens token,
int col)
Uses previous ply's x2 and y2 as x2 and y2 for this move. |
private byte[] |
tokenCaptures(Tokens token,
int col,
java.lang.String row)
Uses previous ply's x2 and y2 as x2 and y2 for this move. |
private byte[] |
tokenCaptures(Tokens token,
java.lang.String row)
Uses previous ply's x2 and y2 as x2 and y2 for this move. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private Handicap handicap
private byte[] previousBoard
private ShogiPly previousPly
private ShogiPly currentPly
private boolean black
private boolean willPromote
private boolean wasPromoted
private BoardPackUtil bpUtil
| Constructor Detail |
|---|
public PlyBoardFactory()
| Method Detail |
|---|
public void generateAndSetBoard(Handicap handicap,
byte[] previousBoard,
ShogiPly lastPly,
ShogiPly newPly,
boolean black)
handicap - needed because handicaps may have less tokens and undefined padding to fill the unused spacepreviousBoard - needed to fully interpret notationlastPly - needed for the notation 'xS' or 'Gx' where a token captures the last moved token at (x2, y2)newPly - current ply to populateblack - whose turn is it now? black or white.private byte[] parseNotation(java.lang.String note)
note -
private byte[] drop(Tokens token,
java.lang.String toSquare)
private byte[] tokenCaptures(Tokens token,
int col,
java.lang.String row)
token - the token that does the capturing.
private byte[] tokenCaptures(Tokens token,
int col)
token - the token that does the capturing.
private byte[] tokenCaptures(Tokens token,
java.lang.String row)
token - the token that does the capturing.
private byte[] tokenCaptures(Tokens token)
token - the token that does the capturing.
private java.lang.String[] getLocations(boolean[][] to)
private int[][] capture(int[][] brd,
java.lang.String toSquare)
brd - toSquare -
private byte[] moveToken(Tokens token,
java.lang.String toSquare)
private byte[] moveToken(Tokens token,
java.lang.String toSquare,
int fromCol)
private byte[] moveToken(Tokens token,
java.lang.String toSquare,
java.lang.String fromRow)
private byte[] moveToken(Tokens token,
java.lang.String toSquare,
int fromCol,
java.lang.String fromRow)
private java.lang.String rowNumber2Letter(int r)
r -
private int getRowNumber(int location)
private int getColumn(int location)
private int getLocationInt(int x,
java.lang.String yS)
x - y -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||