Sudoku class used in java program, JAVA Programming

Assignment Help:

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.


Related Discussions:- Sudoku class used in java program

Program, Develop a code for fibonacci series

Develop a code for fibonacci series

Want an android app to be build, Want an Android App to be Build What i ...

Want an Android App to be Build What i want is a Taxi App for Android and if good price for iOS too. The App want to have a Website where to add Cars whit all information and

Give an example for using getter methods, Give an example for Using Getter ...

Give an example for Using Getter Methods ? class CarTest6 { public static void main(String args[]) { Car c = new Car(); c.setLicensePlate("New York A45 636"); c.setMa

Explain the concept of inheritance, Question: (a) (i) Explain the conc...

Question: (a) (i) Explain the concept of inheritance. Illustrate your answer with a suitable Java example. (ii) Java does not support multiple inheritance but does provide

Describe about basic java programming language, Describe about basic java p...

Describe about basic java programming language? 1. Study the Java programming language: its syntax, patterns, idioms, and styles. 2. Become comfortable along with object orien

Develop the back end of a calculator application, For this assignment, you ...

For this assignment, you will develop the back end of a calculator application. The GUI (graphical user interface) has been provided by your instructor. The application will requir

How to integrate your struts application with spring, To integrate your Str...

To integrate your Struts application with Spring, we have two options: ? Configure Spring to manage your Actions as beans, using the ContextLoaderPlugin, and set their dependenc

Write names of the dos attacks phases, Write names of the DoS attack's phas...

Write names of the DoS attack's phases? DoS (Denail of service): DoS attach has in total 3 kinds of phases and below they are listed: 1. Search 2. Arm 3. Attack

XML File Homework, I need help on java homework. Is it possible to know the...

I need help on java homework. Is it possible to know the shortest possible time to get the solution before giving my commitment

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd