summaryrefslogtreecommitdiffstats
path: root/šola/p1/učenje/Druga.java
blob: 2e86ac57fff5d5bcaf1f68ab407fa6745cd67eb2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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;
	}
}