bool SolverClass::findSolHelp(SimpleVector<Rectangle> &hand, int index) { Rectangle insertRect; hand.getValueAt(index, insertRect); if(findUnused(index, rectangleData)) { if(drawRectangle(index)) { findSolHelp(rectangleData, index + 1); } remove(index); findSolHelp(rectangleData , index); } else if(index == hand.getSize()) { return true; } else { cout << "NO SOLUTION" << endl; return false; } return true; }
bool SolverClass::findUnused(int index, SimpleVector<Rectangle> &hand) { Rectangle temp; int rectCount; for(rectCount = 0; rectCount < hand.getSize(); rectCount++) { hand.getValueAt(rectCount, temp); if(!temp.isUsed()) { index = rectCount; return true; } } return false; }