Public Member Functions
|void||addPieces (unsigned int pc, unsigned int group, unsigned int count)|
|remove all sets and start fresh |
|start a new set of pieces. |
|bool||addPieceToSet (unsigned int pc)|
|Add the pieces you need to the current set. |
Private Member Functions
|unsigned int||findPiece (unsigned int pc, unsigned int gp)|
|grouping_c (const grouping_c &)|
|void||operator= (const grouping_c &)|
|std::vector< set >||sets|
|std::vector< piece >||pieces|
Problem: when trying to disassemble a puzzle with groups there comes up the problem when identical pieces belong to different groups. Because you don't know, to which group the current piece belongs to you don't know what to do.
But the groups assigned to a piece might change the disassembability of the whole puzzle
Example a puzzle made out of 8 identical pieces, 4 belong to group A and the other 4 to group B. The pieces are assembled into such a shape that always 4 do interlock and can not be disassembled. Depending on how the pieces from the 2 groups are distributed between the 2 subassemblies the puzzle is or isn't disassembable.
The functionality in here is supposed to help solve this problem when the disassembler goes along it's way and tries to disassemble a (sub)problem it only stops premature when there is a clear group assignment available, meaning all pieces have a unique group assigned.
Otherwise it tries to disassemble. If this is not possible it checks with the functions in here, if it is possible to assign groups to the pieces in such a way that all the involved pieces are in the same group. The class will allocate the groups to the involved pieces and use this knowledge later on when more groups get added.
|grouping_c::grouping_c||(||const grouping_c &||)||
|void grouping_c::addPieces||(||unsigned int||pc,|
the following functions tell the class what pieces can be in what groups and how many of them are available
Referenced by disassembler_a_c::disassembler_a_c().
|bool grouping_c::addPieceToSet||(||unsigned int||pc||)|
Add the pieces you need to the current set.
Each time you add a new piece you get a return value saying if it can still be done, as soon as you get false from that function you must stop, it can not be true later any way and the function will return unexpected results after the first false
Referenced by disassembler_a_c::subProbGrouping().
|unsigned int grouping_c::findPiece||(||unsigned int||pc,|
|void grouping_c::operator=||(||const grouping_c &||)||