O'Reilly logo

Get Programming with Go by Nathan Youngman and Roger Peppé

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Lesson 29. Capstone: Sudoku rules

Sudoku is a logic puzzle that takes place on a 9 × 9 grid (see en.wikipedia.org/wiki/Sudoku). Each square can contain a digit from 1 through 9. The number zero indicates an empty square.

The grid is divided into nine subregions that are 3 × 3 each. When placing a digit, it must adhere to certain constraints. The digit being placed may not already appear in any of the following:

  • The horizontal row it’s placed in
  • The vertical column it’s placed in
  • The 3 × 3 subregion it’s placed in

Use a fixed-size (9 × 9) array to hold the Sudoku grid. If a function or method needs to modify the array, remember that you need ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required