Section 2

Click once on the "into" debugger button so that we step into the method.

Wait a second here. This method will create the path element that includes the next cell in the laser's path. The value of the "cell" argument makes sense but the value of entry side is #east. That's the wrong direction. We're building a new element here with the correct cell but we think we are entering it from the wrong side. That's a problem.

If we click on the previous method from the debugger call stack we can see the problem originates in the #nextElementIn: method.

The value we give for entrySide, when creating the new element, is incorrect. The temporary variable "direction" is holding the object we can use to work out direction related queries. We need to add some code to GridDirectionEast and the other direction classes to supply an inverted direction for adjacent cells. Here are the new methods we will need.

Index Page Next Page

Copyright © 2007, 2008, 2009, 2010 Stephan B Wessels