validatorDep.js
869 Bytes
/**
* Created by Techniv on 12/01/2017.
*/
function validator(matrix, validationMatrix){
for(var x = 0; x < matrix.length; x++){
var row = matrix[x];
for(var y = 0; y < row.length; y++){
var value = row[y];
if(validationMatrix[x][y] != null) continue;
for(
var z = (x < matrix.length - 1 ) ? x+1 : 0;
z < ((x < matrix.length -1 ) ? matrix.length : matrix.length - 1);
z++
){
if(value == matrix[z][y]){
validationMatrix[x][y] = false;
validationMatrix[z][y] = false;
break;
}
}
if(validationMatrix[x][y] === null) validationMatrix[x][y] = true;
}
}
validator.last = validationMatrix;
return validationMatrix;
}