You're doing a lookahead, right? 1.Set room origin and dimension randomly. 2. Use chkchr to see if it's free. 3. If not, reduce dimension, repeat from 2 until too small. 4. If too small, try again from step 1 until MaxN tries. Goto 7. 5. Draw room. 6. Repeat from 1 until MaxN tries. 7. Done. Something like that?