From e29d0096ec0c589d20fa44a6be70455d914d8172 Mon Sep 17 00:00:00 2001 From: Chad Estioco Date: Mon, 15 Sep 2014 18:38:07 +0800 Subject: [PATCH] Tests are now passing. We relaxed the ACM on the wrong field in GridBoard. Read the docstrings you spend so much time to write! --- .../java/net/skytreader/kode/chesstemplar/BlankBoard.java | 7 ++----- .../java/net/skytreader/kode/chesstemplar/GridBoard.java | 8 ++++---- .../net/skytreader/kode/chesstemplar/BlankBoardTest.java | 1 - 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/main/java/net/skytreader/kode/chesstemplar/BlankBoard.java b/src/main/java/net/skytreader/kode/chesstemplar/BlankBoard.java index 1b7fbec..a03086f 100644 --- a/src/main/java/net/skytreader/kode/chesstemplar/BlankBoard.java +++ b/src/main/java/net/skytreader/kode/chesstemplar/BlankBoard.java @@ -31,8 +31,8 @@ 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){ @@ -40,10 +40,7 @@ public void addPiece(ChessPiece cp, int r, int c){ 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); } } diff --git a/src/main/java/net/skytreader/kode/chesstemplar/GridBoard.java b/src/main/java/net/skytreader/kode/chesstemplar/GridBoard.java index 28a3917..87c3bea 100644 --- a/src/main/java/net/skytreader/kode/chesstemplar/GridBoard.java +++ b/src/main/java/net/skytreader/kode/chesstemplar/GridBoard.java @@ -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 @@ -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)}; diff --git a/src/test/java/net/skytreader/kode/chesstemplar/BlankBoardTest.java b/src/test/java/net/skytreader/kode/chesstemplar/BlankBoardTest.java index ee12d22..3f5fd2a 100644 --- a/src/test/java/net/skytreader/kode/chesstemplar/BlankBoardTest.java +++ b/src/test/java/net/skytreader/kode/chesstemplar/BlankBoardTest.java @@ -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)); } }