Feat: Add wrap and neighbor access methods for grid logic#36
Feat: Add wrap and neighbor access methods for grid logic#36HossamSaberr wants to merge 4 commits intopharo-containers:masterfrom
Conversation
|
This PR has conflicts now :/ |
|
Resolved! |
|
@Ducasse could you review this, please? |
|
@HossamSaberr Nice work on this PR overall. @Ducasse one small follow-up point: issue #17 mentions neighbors “with or without wrapping at edges.” Right now we have non-wrapping neighbors and wrapping for direct access, but not a wrapped-neighbors variant yet. Also, neighborsAtColumn:atRow: does not currently enforce in-bounds origin coordinates, so clarifying expected behavior there would help. What do you think? |
|
Thanks for the review, @virenvarma007! Spot on with the wrapped variant, I'll add the out-of-bounds origin for I'll push the updates for both of these, along with the tests |
|
I've pushed the updates to address the points you raised @virenvarma007 |
|
This looks really good to me. Although we should wait for @Ducasse ’s take before we call it fully done, but either way, @HossamSaberr thank you for the effort you put into this. |
This PR implements the boundary and adjacency logic.
Wrapping: Added
atColumnWrap:atRowWrap:andatColumnWrap:atRowWrap:put:to allow seamless boundary wrapping using 1-based modulo arithmetic.Neighbors: Added
neighborsAtColumn:atRow:to safely fetch up to 8 surrounding valid elements without out-of-bounds errors.Testing: Added tests in
CTArray2DTestcovering normal access, edge wrapping and a full 8-neighbor.Fixes About wrap and neighbors #17