About these ads

Mindstorms NXT Sudoku Game Pt. 4: Initial Release

27 07 2012

Read more about my Sudoku game here: part 1, part 2, part 3, part 4

Although I spent most of today packing for vacation (you probably won’t see too many updates on this site the coming three weeks), I managed to squeeze in a couple of hardcore programming hours, which allowed me to finish a first working version of my sudoku game. Some screen shots:

So here’s how it works:

  1. The user selects a difficulty (the higher the difficulty, the less visible clues) using the left and right arrow keys and then clicks the orange button
  2. A completely random Sudoku is generated and displayed on the screen
  3. The arrow keys are used for navigating the grid: the left key moves the cursor over one spot to the left, and the right arrow key moves the cursor down one spot. If the user reaches a side/ corner, the next arrow click will bring the cursor to the other side of the playing field, as illustrated below:

  1. Clicking the square orange key when an editable cell is selected (“clue” cells aren’t editable) will increment the cell’s value by 1, unless its value is 9, in which case the cell will be reset to 0
  2. Clicking the rectangular gray key will check the user’s version of the sudoku against the answer key (a copy of the generated sudoku without the non-clue cells removed), and tell the user how many errors there are. If there aren’t any, a “You win!” message will appear and the program will be aborted; if there are errors (including un-solved cells), the user will be asked if he/ she wants the wrong cells reset — if yes, the program will clear these cells, if no, they’ll remain wrong and the user will return to the game

So overall I’m very pleased with the game, because it was quite challenging to make it work doing some pretty difficult things, such as:

  • Generating a completely random Sudoku from scratch every time the program runs
  • Deciding which cells could safely be hidden from the user while still keeping the Sudoku solvable
  • Making a custom, smaller, font for the NXT to be able to show a grid around the numbers.

Anyways, if you’d like to download the most current code for this project, see this page here:

https://sourceforge.net/projects/dimastero/files/Sudoku/?

Changelog:

  • v1.0.0 (7/27/2012) Initial release
  • v1.0.1 (7/27/2012) Added documentation

Read more about my Sudoku game here: part 1, part 2, part 3, part 4

About these ads

Actions

Information

3 responses

11 08 2012
SheaPress » Mindstorms NXT Sudoku Game Pt. 4: Initial Release

[...] Read more about my Sudoku game here: part 1, part 2, part 3, part 4 Although I spent most of today p… Shea Bunge [...]

30 03 2013
blog | leonoverweel.com | Mindstorms NXT Sudoku Game Pt. 2: Hide and Seek

[...] Read more about my Sudoku game: part 1, part 2, part 3, part 4 [...]

30 03 2013
blog | leonoverweel.com | Mindstorms NXT Sudoku Game Pt. 3: Smaller Font

[...] Read more about my Sudoku game: part 1, part 2, part 3, part 4 [...]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s




Follow

Get every new post delivered to your Inbox.

Join 41 other followers

%d bloggers like this: