Sudoku class used in java program, JAVA Programming

Sudoku Class (Simple Version)

The Sudoku class will encapsulate the minimum necessary data and logic to manipulate, print, and set the SudCells, in anticipation of a higher level Solver class.  This should not contain logic that is about the solution algorithm.  There is a little wiggle room in here, because you do have to allow the basic maneuvers that a Solver class would need, and these might be considered part of the algorithm, but I have determined where to draw the line for you, and you will see this in the choice of my included methods.

The most obvious data structure that Sudoku must contain is a 2-D array (matrix) of SudCells.  The second aspect of this class is the grouping of nine small 3x3 sub-matrices which most people call groups or blocks, but I wanted to call Sectors. Here is a picture of the data organization of a Sudoku object for our project:

2143_Sudoku Class.png

It is made up of SudCell objects (informally, "cells"), but we also want use the terms row, column and sector when describing fundamental operations that our Solver might need.  For instance the Solver might ask the Sudoku to "force the number 1 into cell (2, 3)" (row two column three).  Or maybe it needs to say, "rule out the value 9 from cell (5, 1)". It may need to ask, "how many possible digits (true values) are left in cell (1, 1)?"

There will also be a few methods that border on Solver actions, but they are so fundamental that we can safely put them into the Sudoku class.  For example, we want a method that tells us when the Sudoku is solved. In our implementation, I provide a method that returns true if each cell has only one remaining value (only one true in the digits[] array).  Similarly, there are methods that total up all the remaining un-ruled out values for the entire 9x9 suds[] array, something that will be helpful for algorithms to know ("have we ruled out any new values since the last rule we applied or are we going around in circles?")

In summary, our Sudoku class will have to collect 81 SudCells in a 9x9 matrix, but also superimpose nine 3x3 sectors on these same SudCells.  It will have to have accessor-like and mutator-like methods to inquire about and make changes to individual SudCells based on row, column and sector.  Because the nine sectors are very tricky, this will not be done in Option A.  If you are up to the challenge, you would attempt that in intermediate/advanced options.

Posted Date: 2/16/2013 5:15:27 AM | Location : United States







Related Discussions:- Sudoku class used in java program, Assignment Help, Ask Question on Sudoku class used in java program, Get Answer, Expert's Help, Sudoku class used in java program Discussions

Write discussion on Sudoku class used in java program
Your posts are moderated
Related Questions
Output first x values in the fibonacci sequence, where x is an argument to the program. 0, 1, 1, 2, 3, 5, 8, ... Write the fibonacci creation function separate from the main func

Objective The objective of this lab exercise is to develop a unit test suite using JUnit Specification of the Program to be Tested You are given the source code of a Java clas

Write down HTML or JavaScript code for the following requirements: Declare an Array along with the identifier SUBJECT having length 5. Assign subsequent values to the array par

Question: A new software engineer has joined Axistex Ltd. The systems analyst informs him that the organisation works with different operating system. The HR department works w

Describe Invoking Methods in java? class Car { String licensePlate = ""; // e.g. "New York 543 A23" double speed = 0.0; // in kilometers per hour double maxS

EJB 2.x is broadly adopted server side component architecture for J2EE. 1. EJB is a remote, distributed multi-tier system and allows protocols like IIOP, JRMP, and HTTP etc.

Students will design, develop, test and document a Java application that reads data from an input file, processes the data, and then writes the processed data to an output file. CM

Application or website to upload DICOM files from CD to Drop box etc Project Description: I need a website code or application to make patients put a cd or DVD to their disk

how to request one servlet to another by passing value

In addition to your Java code requirements, you also need to enhance the ZHTML for your application. As before, you can continue working with the page(s) you used for the previous