Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi I was wondering if someone could explain the pseudo-code and how the is valid suppose to be set up? udoku is a fun little

image text in transcribedHi I was wondering if someone could explain the pseudo-code and how the "is valid" suppose to be set up?

udoku is a fun little logic puzzle where the objective is to fill a 99 grid with digits so that each column, ach row, and each of the nine 33 sub-grids contain all digits from 1 to 9 . Solving one of these involves lot of testing and back-tracking when numbers don't work out. It's not something a simple program oop can do, but it's perfect for our new tool: recursion. more info on Sudoku: https://en.wikipedia.org/wiki/Sudoku Program requirements: - Create a new class called Sudoku.java - Inside your main program, create an array of arrays of size 99 (see code below). For empty spots, use the number 0 . - Your program must use a recursive backtracking algorithm to solve for each square. This algorithm will attempt to fill each spot in the array with a number (1-9) and check if the number has been used in the row, column, or tie 33 sub-grid. To accomplish this with recursion, here is the general flow in pseudo-code: solvesudoku() Loop through each row Loop through each column if this row/column combination has no number assigned Loop through numbers 19 Check to see if the number is valid here if yes, do solveSudoku () if no, this row/column combo is unassigned end loop return false end loop for column lop row - For the "is valid" check, you should make three functions: is lnRow(), is lnColumn(), and islnGrid(). Then call each one for your candidate number. - Create and call a method that prints out the board before and after the solution is made - Optional: note that this program only attempts to solve the puzzle but doesn't confirm if it is complete. How could you use recursion to both solve for and verify your solution? Here's a bit of code that will fill your array up and get you started going forward

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases A Beginners Guide

Authors: Andy Oppel

1st Edition

007160846X, 978-0071608466

More Books

Students also viewed these Databases questions

Question

What is the cerebrum?

Answered: 1 week ago

Question

Persuasive Speaking Organizing Patterns in Persuasive Speaking?

Answered: 1 week ago