summaryrefslogtreecommitdiffstats
path: root/šola/p1/učenje/Druga.java
diff options
context:
space:
mode:
Diffstat (limited to 'šola/p1/učenje/Druga.java')
-rw-r--r--šola/p1/učenje/Druga.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/šola/p1/učenje/Druga.java b/šola/p1/učenje/Druga.java
new file mode 100644
index 0000000..2e86ac5
--- /dev/null
+++ b/šola/p1/učenje/Druga.java
@@ -0,0 +1,22 @@
+public class Druga {
+ public static boolean krizankaOK (char[][] besede, char[][] polozaji) {
+ char križanka[][] = new char[20][20];
+ for (int i = 0; i < besede.length; i++)
+ for (int j = 0; j < besede[i].length; j++) {
+ int vrstica = polozaji[i][0]-'0';
+ int stolpec = polozaji[i][1]-'0';
+ if (polozaji[i][2] == 'v')
+ stolpec += j;
+ else
+ vrstica += j;
+ if (križanka[vrstica][stolpec] == '\000') {
+ križanka[vrstica][stolpec] = besede[i][j];
+ continue;
+ }
+ if (križanka[vrstica][stolpec] == besede[i][j])
+ continue;
+ return false;
+ }
+ return true;
+ }
+}