package tp.p2.game; import tp.p2.util.MyStringUtils; /** * @author Fernando M�ndez Torrubiano * */ public class BoardPrinter implements GamePrinter { private int numRows; private int numCols; private String[][] board; private final String space = " "; public BoardPrinter(int maxfil, int maxcol) { this.numRows = maxfil; this.numCols = maxcol; } @Override public String toString(Game game) { encodeGame(game); int cellSize = 7; int marginSize = 2; String vDelimiter = "|"; String hDelimiter = "-"; String rowDelimiter = MyStringUtils.repeat(hDelimiter, (numCols * (cellSize + 1)) - 1); String margin = MyStringUtils.repeat(space, marginSize); String lineDelimiter = String.format("%n%s%s%n", margin + space, rowDelimiter); StringBuilder str = new StringBuilder(); str.append(lineDelimiter); for(int i=0; i