Skip to content

Commit

Permalink
Tests are now passing.
Browse files Browse the repository at this point in the history
We relaxed the ACM on the wrong field in GridBoard. Read the docstrings you spend
so much time to write!
  • Loading branch information
skytreader committed Sep 15, 2014
1 parent c726e6f commit e29d009
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
Expand Up @@ -31,19 +31,16 @@ public BlankBoard(){
}
}

WHITE_LIST = Arrays.asList(WHITE_ARRANGEMENT);
BLACK_LIST = Arrays.asList(BLACK_ARRANGEMENT);
WHITE_LIST = Arrays.asList(whitePieces);
BLACK_LIST = Arrays.asList(blackPieces);
}

public void addPiece(ChessPiece cp, int r, int c){
if(cp.isWhite()){
int posIndex = WHITE_LIST.indexOf(cp);
board[r][c] = getWhiteRep(posIndex);
} else{
System.out.println(BLACK_LIST.toString());
System.out.println(Arrays.toString(BLACK_ARRANGEMENT));
int posIndex = BLACK_LIST.indexOf(cp);
System.out.println("THIS: " + (posIndex));
board[r][c] = getBlackRep(posIndex);
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/net/skytreader/kode/chesstemplar/GridBoard.java
Expand Up @@ -16,8 +16,8 @@
@author Chad Estioco
*/
public class GridBoard implements Board{
private ChessPiece[] whitePieces = new ChessPiece[16];
private ChessPiece[] blackPieces = new ChessPiece[16];
protected ChessPiece[] whitePieces = new ChessPiece[16];
protected ChessPiece[] blackPieces = new ChessPiece[16];
/**
Convention: Unoccuppied squares contain negative integers, while occupied
squares contain positive integers. Let w be the index of a white piece in
Expand All @@ -31,11 +31,11 @@ public class GridBoard implements Board{
*/
protected int[][] board = new int[8][8];

protected final ChessPiece[] BLACK_ARRANGEMENT = {new Rook(false), new Knight(false),
private final ChessPiece[] BLACK_ARRANGEMENT = {new Rook(false), new Knight(false),
new Bishop(false), new Queen(false), new King(false), new Bishop(false),
new Knight(false), new Rook(false)};

protected final ChessPiece[] WHITE_ARRANGEMENT = {new Rook(true), new Knight(true),
private final ChessPiece[] WHITE_ARRANGEMENT = {new Rook(true), new Knight(true),
new Bishop(true), new Queen(true), new King(true), new Bishop(true),
new Knight(true), new Rook(true)};

Expand Down
Expand Up @@ -38,7 +38,6 @@ public void testAddPieceWhite(){
public void testAddPieceBlack(){
Pawn blackPawn = new Pawn(false);
board.addPiece(blackPawn, 4, 4);
System.out.println("I AM ONE WITH THE GODS: " + board.getPieceAt(4, 4));
Assert.assertEquals(blackPawn, board.getPieceAt(4, 4));
}
}

0 comments on commit e29d009

Please sign in to comment.