Pages: 1
Topic closed
I was trying to create a sudoku solving engine and realized I have no idea how. Mainly to better my knowledge of scratch, I was just wondering how I might write a script to set a sum of variables equal to a number (in this case 45: i.e. v1 + v2 +v3 +v4 +v5 +v6 +v7 +v8 +v9= 45)
Also, how do I ensure that v1 is not equal to v2 or v3 or v5 or etc and that it is a number 1-9?
These are very complicated questions and I apologize but if you could help that would be great.
I realize lists are a viable option but I can't figure out how to make them work for what I want to do.
Offline
Well, in these types of things you'll have to use lists...
I made a script for this - first, it fills a list with the numbers 1 to 9 - then, it fills a second list by (repeatedly until all the numbers have been used) randomly choosing one of the items from the first list, taking the number from the item and placing it in the second list, and then deleting the item from the first list so it can't be used again.
Here's the script:
Is that understandable?
Offline
Topic closed
Pages: 1