small medium large xlarge

Hi,

I’ve been using your amazing book to teach myself Swift/IOS programming. It is as you say the perfect reinvigoration of programming joy!

However, I’m stuck on the weave overcell/undercell drawing. My drawing code has drifted from yours and I’m struggling to work out how to produce the weave look.

This link http://cl.ly/image/2c2u2M351Z1m is a fragment of one of mazes where 3,1 has an undercell http://cl.ly/image/1w2j1U1c3z0p as you can see I don’t get your weave, I just get two little horizontal dashes…

Can you just give me a two sentence guide, like “Overcells always have inset walls, but undercells have no inset.”. I’m sorry, I keep reading and re-reading your chapter, but I can’t quite see the trick for illustrating the weave…

Again, I love the book… I’m just a little stuck!

Regards,

Rob Paterson

Hello Rob,

I’m sorry this is proving so tricky! If you don’t mind posting your code somewhere, I could take a look and see if I can spot what’s going on there. Otherwise, I think the two key points in the book are the illustration at the top of page 140 (showing the locations of x1-x4 and y1-y4), and then the code snippet on the bottom of page 150 and the top of page 151.

Essentially, OverCells are always drawn just as before, but UnderCells draw only the small walls on the corresponding insets (north/south for vertical passages, east/west for horizontal).

I don’t know how much help that is. Please let me know how it goes!

• Jamis

Hi Jamis,

Wow I almost despaired on this one!

Turns out that it had nothing to do with my drawing code… I had a polymorphism bug where my UnderCell could link to its OverCell neighbours, but the bidirectional link from the OverCells back to the UnderCell failed… silently….

Of course I didn’t discover this until I rewrote my entire drawing code to match your code exactly… only to find I still had the exact same problem!

Thanks again for such a fun, frustrating, challenging, engaging, and energising book!

I’m glad you figured it out! if there was anything I could have made clearer in the book, which might have saved you some headache, please let me know. Maybe a future edition could help other readers!

• Jamis
You must be logged in to comment