print sudoku
All checks were successful
Linux arm64 / Build (push) Successful in 35s

This commit is contained in:
2025-01-10 16:58:49 +01:00
parent d38e779060
commit 6ab5242956
3 changed files with 36 additions and 5 deletions

View 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);
}
}
}