Computer Science I - Programming Assignment 5

Due Wednesday, December 9th

Summary

For this assignment you will create a web page called sudoku.html that will display a Sudoku puzzle for the user to solve. It should look something like this:

screenshot of application (with empty squares)

A Sudoku puzzle is a nine by nine grid of numbers (from 1 to 9) with some of the squares in the grid left empty. Additionally the grid is divided into nine three by three sub-grids (usually outlined with a thicker black line). To solve a Sudoku puzzle one must fill in the empty squares with numbers (again from 1 to 9) so that each row, each column, and each sub-grid contains all nine numbers (which means no row, column or sub-grid can contain two or more of the same number.)

For example, the solution to the puzzle above would look like this:

screenshot of application (with solution)

Note that in the examples, in addition to the puzzle itself, there are three buttons and a text box. The three buttons should test to see if the user's answers violate any of the rules described above. Clicking the "Check Columns" button should verify that every number between 1 and 9 appears in each column, and print a message in the text box indicating the result (e.g. "columns are ok" or "columns are not ok". The other two buttons should to the same with respect to the rows and subgrids of the puzzle.

If you want an extra challenge you can indicate which row, column or subgrid violates the rules. Again, make sure to get the required functionality working (and saved) before adding extra features.

Files

I have already implemented the part of the code that constructs the puzzle here: sudoku.html. Your job is to implement the functions CheckRows, CheckColumns, and CheckSubgrids.

Helpful Hints

Instructions for Handing In the Program

Please hand in the following:

Do not put your assignment in your html directory as that is publicly viewable.