This commit is contained in:
23
app/src/main/java/sudoku/io/SudokuPrinter.java
Normal file
23
app/src/main/java/sudoku/io/SudokuPrinter.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package sudoku.io;
|
||||
|
||||
import sudoku.Sudoku;
|
||||
|
||||
public class SudokuPrinter {
|
||||
|
||||
public static void printRectangleSudoku(final Sudoku s, int blockWidth, int blockHeight) {
|
||||
for (int y = 0; y < s.getSize(); y++) {
|
||||
if (y % blockHeight == 0 && y > 0) {
|
||||
System.out.println("");
|
||||
}
|
||||
String line = "[ ";
|
||||
for (int x = 0; x < s.getSize(); x++) {
|
||||
line += (s.getCell(x, y).getSymboleIndex() + 1) + " ";
|
||||
if (x % blockWidth == blockWidth - 1 && x != blockWidth * blockHeight - 1) {
|
||||
line += "| ";
|
||||
}
|
||||
}
|
||||
line += "]";
|
||||
System.out.println(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user