bool Application::valid(const Position& pos) { int irow, icol; bool q_found; // Check if its on the grid // if (pos.getRow() >= 0 && pos.getRow() < ROWS && pos.getColumn() >= 0 && pos.getColumn() < COLUMNS && grid[pos.getRow()][pos.getColumn()] == CORRIDOR) { // ---- PROBLEMS HERE ----- // // Check if there is another queen on this row // /* for(irow = pos.getRow(), icol = 0; icol < COLUMNS; icol++) { if(icol == pos.getColumn()) // Exclude the queen we just placed icol++; if(grid[irow][icol] == PATH); return false; } // Check if there is another queen in this column // for(icol = pos.getColumn(), irow = 0; irow < ROWS; irow++) { if(irow == pos.getRow()) // Exclude queen we just placed irow++; if(grid[irow][icol] == PATH) return false; } //Check diagonally for other queens // *//* for() { }*/ } return true; }