❔ I want to find objects within objects. using composite pattern
Hello I have an sudoku application that can check weither an number is correct or not. The current sudoku formats are regulars (4x4, 9x9 etc), jigsaw and samurai sudoku's.
Now I want to check weither an samurai sudoku number is correct.
The only problem is that I have build up my sudoku's as followed:
regular & jigsaw (so both for example 9x9 grid) : have 27 Clusters with each 9 cells (9 rows with 9 cells, 9 columns with 9 cells and 9 blocks with 9 cells'
samurai: have 15 clusters (1 cluster is 1 sudoku because samurai has 5 total sudoku's so times 3 because of the rows, blocks and columns) with children each 9 clusters and there in each cluster has 9 cells.
the problem i'm heading is that the check works for regular and jigsaw but not for samurai because of the build.
I don't want to change anything to the build but I want to ask how to solve this.
Anyone have any idea how I can iterate over the clusters in clusters. I´ve tried recursion but did not work yet
2 Replies