summaryrefslogblamecommitdiffstats
path: root/šola/p1/učenje/Druga.java
blob: 2e86ac57fff5d5bcaf1f68ab407fa6745cd67eb2 (plain) (tree)





















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