while loop sometimes loops infinitely, but sometimes works fine
I´m developing a program to fill a 9x9 board with values from 1 to 9, and those values shouldn´t repeat in rows or columns. Although the (abstract) way to do it is easy, the program doesn´t work properly. It works fine up to 4 values (1,2,3,4), but it gets into an infinite loop for the rest of the values (5,6,7,8,9). Some rules: The matrix have to end up with all the values 1..9, with no two equal values in a row/column; so a valid column could be (3,5,2,1,9,7,6,4,8), and the rows as well but e.g. the value of cell 0,0 and 1,1 could be the same (since they are in different rows and columns) I
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.