© Moritz Lenz 2017

Moritz Lenz, Perl 6 Fundamentals , https://doi.org/10.1007/978-1-4842-2899-9_3

3. Formatting a Sudoku Puzzle

Moritz Lenz

(1)Fürth, Bayern, Germany

As a gentle introduction to Perl 6, let’s consider a small task that I recently encountered while pursuing one of my hobbies.

Sudoku is a number-placement puzzle played on a grid of 9×9 cells, subdivided into blocks of 3×3 (Figure 3-1). Some of the cells are filled out with numbers from 1 to 9, some are empty. The objective of the game is to fill out the empty cells so that in each row, column, and 3×3 block, each digit from 1 to 9 occurs exactly once.

A449994_1_En_3_Fig1_HTML.jpg
Figure 3-1. A Sudoku puzzle in its ...

Get Perl 6 Fundamentals : A Primer with Examples, Projects, and Case Studies now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.