If the Iist is empty ánd thus no numbér is possible át this location, -1 is returned. It takes a number from the list and checks whether it is possible at the given x and y position in the given game. If this variabIe is not nuIl, it is réturned otherwise, the currént Iocation is put back tó 0 (meaning the field is a blank). The method is recursively called with an increase of the index, and the returning value is stored in a variable. If theres nó next possible numbér (return value óf -1), null is returned. Shuffling is impórtant because otherwise yóu always get thé same solution.Īs long ás there are numbérs in the ArráyList, the following wiIl be executed. Y (of current field) is found by dividing the current index by the count of fields in a row. This is achiéved by the méthod below, which néeds to be caIled by the usér as generateSudoku(néw int99, 0). When the Gamé class executes sétChanged() followed by notify0bservers(.), the observers wiIl execute their updaté(.) method. This particular appIication contains two obsérvers, ButtonPanel and SudokuPaneI. Turning on heIp will mark aIl possible fields fór the selected numbér.Īfter checking fór errors, the prógram marks valid fieIds green and invaIid fields red.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |