This site requires JavaScript, please enable it in your browser!
Greenfoot back
magentaink
magentaink wrote ...

2024/11/29

Checking the Solution for a Picross Game

1
2
magentaink magentaink

2 days ago

#
Ah I see, just to double check, the indexes on the solutions array are row, column, solution right? I didn't think it would make that much of a difference since the clues essentially mean the same thing as the solution but I suppose the way it's stored and used does make the difference. How would an array representing my clues look so it doesn't turn out looking exactly like the solutions? I'm struggling to visualise how two 2D arrays in a 3D array would work for it?
danpost danpost

yesterday

#
magentaink wrote...
I'm struggling to visualise how two 2D arrays in a 3D array would work for it?
Each 2D array in the 3D array is a solution with increasing difficulties. I only combined what you already had to simplify things.
just to double check, the indexes on the solutions array are row, column, solution right? I didn't think it would make that much of a difference since the clues essentially mean the same thing as the solution but I suppose the way it's stored and used does make the difference. How would an array representing my clues look so it doesn't turn out looking exactly like the solutions?
The coder decides what the best way to represent things is. For the clues, you really have two 2D arrays -- one for across the top of the grid and one for the left side of the grid. To avoid a lot of confusion, do not necessarily make the first index being one axis and the other, well, the other axis. It would probably be best to have the first index refer to its length (or grid size along one axis) and the second index indexing the clue along the other axis. It is tedious, but much less confusing and much less tedious that going the other route (axis-axis indexing -- because the two 2D array have switched axis referencing).
You need to login to post a reply.
1
2