int CheckAssignments() { Eigen::ArrayXi col_check = y_; int unassigned = n_; int error = 0; for(int row=1 ; row<=n_ ; ++row) { int col = x_.coeff(row-1); if( col != 0 ) { assert( row == y_.coeff(col-1) ); unassigned -= 1; col_check(col-1) = 0; } } assert( col_check.sum() == 0 ); return error; }
int analyze(char matrix[][size]) { // row check for(int row=0; row<size; row++){ row_check(matrix, row); } // column check for(int col=0; col<size; col++){ col_check(matrix, col); } // diagonal for(int x=0; x<2; x++){ x_check(matrix, x); } }
int addtomap(t_tetr *tetr, char **map, int *pos, int map_size) { int i; int j; i = pos[0] + (pos[1] * map_size); j = tetr->posx + (tetr->posy * 5); if (col_check(tetr, map, pos, map_size)) return (0); while (tetr->data[j] != '\0') { if ((map_size != 2) && (i == map_size * map_size)) return (1); if (tetr->data[j] == '#') map[(i / map_size)] [(i % map_size)] = tetr->letter; if (tetr->data[j] == '\n') i += map_size - 5; i++; j++; } return (1); }