diff --git a/domace-naloge.iml b/domace-naloge.iml index c90834f..bf6e310 100644 --- a/domace-naloge.iml +++ b/domace-naloge.iml @@ -7,5 +7,16 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/DN06.java b/src/DN06.java new file mode 100644 index 0000000..edaa446 --- /dev/null +++ b/src/DN06.java @@ -0,0 +1,37 @@ +public class DN06 { + static double offset = 0.01; + static double size = (1 - 2 * offset) / 9; + + public static void main(String[] args) { + String input = args[0]; + + StdDraw.setPenRadius(0.005); + StdDraw.square(0.5, 0.5, 0.5 - offset); + + for (int i = 1; i < 9; i++) { + if (i % 3 == 0) + StdDraw.setPenRadius(0.005); + else + StdDraw.setPenRadius(0.001); + + StdDraw.line(offset, offset + size * i, 1 - offset, offset + size * i); + } + + for (int i = 1; i < 9; i++) { + if (i % 3 == 0) + StdDraw.setPenRadius(0.005); + else + StdDraw.setPenRadius(0.001); + + StdDraw.line(offset + size * i, offset, offset + size * i, 1 - offset); + } + + for (int y = 0; y < 9; y++) { + for (int x = 0; x < 9; x++) { + String number = String.valueOf(input.charAt(y * 9 + x)); + if (number.equals("0")) continue; + StdDraw.text(offset + size / 2 + x * size, 1 - (offset + size / 2 + y * size + offset - 0.005), number); + } + } + } +}