Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool TLabirynt::MissPathStep( bool& pCompleted, TElement* pCurrentElement, System::Windows::Forms::Form^ pFr, bool pVisualize )
- {
- labVectType candidates;
- labIterType it;
- bool success = false;
- //if ( pVisualize ) pFr->Refresh();
- if (pVisualize && !(pCurrentElement->Visited)) pFr->Refresh();
- //set visited flag for current element
- pCurrentElement->Visited = true;
- //find neighbours - candidates to next step
- candidates = FindConnectionCandidates( pCurrentElement );//check the path i completted
- //check completed
- if ( pCompleted = LabiryntMissPathComplete( pCurrentElement, candidates ) ) return true;
- //suffle randomly candidates
- ShuffleCandidates( candidates );
- //try next step for all candidates
- for ( it = candidates.begin(); it != candidates.end() && !success; it++ )
- {
- pCurrentElement->Connect( (*it) );
- success = MissPathStep( pCompleted, (*it), pFr, pVisualize );
- }
- if ( success )
- {
- TmpMissElements.push_back( pCurrentElement );
- return true;
- }
- else //no step posibility in this recursion
- {
- return false;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement