diff --git a/ProjectDiary.md b/ProjectDiary.md index 13f661a..e69de29 100644 --- a/ProjectDiary.md +++ b/ProjectDiary.md @@ -1,2 +0,0 @@ -Start -asjdbakjdsf \ No newline at end of file diff --git a/sudokuExample/src/Main.java b/sudokuExample/src/Main.java new file mode 100644 index 0000000..031de2e --- /dev/null +++ b/sudokuExample/src/Main.java @@ -0,0 +1,46 @@ +import java.util.Scanner; + +class Main { + + //sudoku counts from 1 to 9 - sCount + static final int SCOUNT = 9; + + static int field[][] = new int[SCOUNT][SCOUNT]; + + public static void main(String[] args) { + + while (true) { + int[] transaction = readInput(); + field[transaction[0]][transaction[1]] = transaction[2]; + output(field); + } + } + + private static void output(int[][] field) { + + for (int i = 0; i < SCOUNT; i++) { + for (int j = 0; j < SCOUNT; j++) { + System.out.print(field[i][j] + " "); + } + System.out.println(); + } + + } + + static int[] readInput() { + + Scanner scanner = new Scanner(System.in); + String line = scanner.nextLine(); + System.out.println(line); + + String substring = line.substring(line.indexOf('(')+1, line.indexOf(')')); + String[] split = substring.split(","); + + int[] transaction = new int[split.length]; + for (int i = 0; i < split.length; i++) { + transaction[i] = Integer.valueOf(split[i]); + } + + return transaction; + } +} \ No newline at end of file