Have you looked at the code for Moria, Angband, etc? Those games also generate random maps like yours, and you might be able to glean some good ideas from them. It's C, but the algorithms would translate over pretty smoothly.
http://www.idevgames.com, search for Moria, Angband. Lots of other neat stuff there, too.
---
A fair fight is a sign of poor planning.