How do I create a simple Sudoku?

Get help using Construct 2

Post » Sat Jun 21, 2014 5:35 am


You can do a neater version of the function using the "Array -> For each XY element" condition instead of a nested for, but this way is more efficient because it loops backwards on the array and stops as soon as it finds the last element that matches your search.

There's a slight problem with this however: this implementation assumes that rows have higher priority in the ordering of elements than columns. This means that in this array

0 2 4
3 5 2
4 2 1

The 'last' 2 would be the one on (1,2), and so LastYIndexOf(2) would return 2

While if you gave higher priority to columns, the last element would actually be the 2 on (2,1) and so LastYIndexOf(2) would return 1

You have to take this into consideration when filling your array. It's not a big problem though, since general convention is to give rows higher priority anyways.
Posts: 79
Reputation: 608

Post » Sat Jun 21, 2014 7:27 am

Thank you very much.

Edit: this event is checking the whole array instance here, not the rows & the columns seperated - the main problem remains.

For Sudoku I need to check for same values each row and column - itself.
Posts: 396
Reputation: 4,977


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 4 guests