Open NicMcPhee opened 7 years ago
Looking back over it with the students today, it turns out that the problem is what I call the "center" triangle in the write-up. Because it "points" the opposite direction from the others, it ends up needing to be treated separately, which makes it more difficult to have a single Worker
class.
It turns out, though, that if you "reflect" that triangle by swapping all the i
s and j
s you get the same set of differences in a triangle that "points" the same direction as the others and which can be handled uniformly.
I think the range we want there is N/2≤j<i+n/2<N. But I'm not entirely sure if we need to swap all the i
s for j
s in this range, and if we do then we would still need to treat that separately. Hmph. I need to do some more math.
The current setup suggests people create four separate inner classes, one for each triangle. Can't we have one inner class with arguments that indicate how the ranges should be handled, to avoid a lot of annoying duplication?