SlideShare a Scribd company logo
1 of 4
Download to read offline
Project 4: Sodoku Solver 
Deadline: 11:30am, October 19th 
Read this document carefully and completely before you attempt to solve programming project 4. 
Description: 
It is a popular logic-based number placement game. The aim of the puzzle is to enter a 
numerical digit from 1 through 9 in each cell of a 99 grid made up of 33 sub grids (called 
boxes). The game starts with various digits given in some cells (the givens). When 
finished, each row, column, and 3x3 regions must contain all 9 digits with no repetition. 
Completing the game requires patience and logical ability. Here is an interesting site if you 
would like to try and play the game http://www.dkmsoftware.com/sudoku/  
http://www.sudoku.com/ 
There are 3 simple rules you must follow when playing Sudoku. Fill in the grid so that 
1) every row 
2) every column 
3) ever 3x3 box 
contains the digits 1 through 9. 
• row: 
This is a row that is 9 cells wide. A filed row must have one of each digit. That 
means that each digit appears 
only once in the row. There are 
9 rows in the grid, and the same applies to each of them. 
• column: 
This is a column, 9 cells tall. A filled column consists of having one of each 
digit just like the row. This means each digit will appear only once in the 
column. There are 9 columns in a typical Sudoku grid, and the same 
applies to each of them. 
• box: 
This is a box containing 9 cells in a 3x3 layout. A filled box consists of 
having one of each digit just like the rows and columns. 
This means that each digit appears only once is in the 
box. There are 9 boxes in a typical Sudoku grid, and the 
same applies to each of them.
You will notice that the maroon colored digits are the “givens” and the gray shaded digits are 
the possible digits that can be added to the row, column or grid to satisfy the 3 rules above. 
Unsolved Solved 
Implementation: 
• bool Solve (): 
o You will implement a solve() function to solve your Sudoku grid. Your solve 
function should a recursive function, meaning that this function will call itself 
continuously until the game has been solved. Each recursive function will try 
different values applying each of the 3 rules and return a bool back to itself. 
If a FALSE is returned then the puzzle cannot be solved, and if a TRUE is 
returned the puzzle is solved. When your solve function has completed 
solving the game, your program will save the contents of solved or unsolved 
Suduko board. 
• Save (): 
o The save function will print the contents of solved Suduko board to the 
screen followed by solved. If the game cannot be solved then your program 
should print out what it had completed up until the point it determined the 
game is unsolvable followed by unsolved. 
• ostream operator  
o You will want to overload an ostream’s  operator so that you can display a 
user defined object. Here is an example of overloading, 
http://gethelp.devx.com/techtips/cpp_pro/10min/10min0400.asp 
• You will also need to implement and default constructor, a copy constructor, a 
destructor and an assignment operator for your objects.
Your projects directory structure: 
• The same as described in project 3. You must comment your code using Doxygen. 
We will read you code using Doxygen generated documentation. 
• Running make should produce the prj_4 executable under the bin directory. Running 
‘doxygen’ with the included Doxyfile should produce documentation under your 
doc/html directory 
• Your project should be up to date on the svn server for checkout when completed 
Getting Started: 
• svn checkout https://svn.cs.fsu.edu/repos/teamXY/prj_4 
o Will be available shortly after midterm 
• Familiarizing yourself with the game and its rules at one of the websites listed above. 
• Read in input from file and populate your data structure to hold the values. 
o Consider using a 2D array and for each element in the array have a vector. 
Once you understand the rules, you will see that for every blank spot in the 
Sudoku board you will have a possible of 1-9 candidates to try. And whether 
those candidates work or not will depend upon the three Sudoku rules. So 
your vector will contain initially values 1 – 9 and as your populate your board 
you will update those values in the candidate vector for each cell in your 
Sudoku board. 
• Your solve function will be a recursive function that will call itself and try new values 
for each spot in the Sudoku board until all of the 3 rules are satisfied. 
o Consider perhaps making copies of your Sudoku objects and updating the 
candidate vectors of the board to reflect the new number that you have 
chosen.
Input and Output Format: 
Input: 
• Your program should take in input file containing the rows of initial information to 
populate your sudoku game to be solved. 
• usr@linrprog4:~/prj_4/bin/  prj_4 sudoku_input1 
o Your input file should be in the following format. 
 ********* 
 8**3*5**2 
 **6***9** 
 *4*5*6*8* 
 7*1***4*9 
 ***9*1*** 
 97**6**35 
 **3***1** 
 **4*2*7** 
Output: 
• Your program should output either the solved or the unsolved sudoku. 
o +---+---+---+ 
|425|697|318| 
|897|315|642| 
|136|482|957| 
+---+---+---+ 
|349|576|281| 
|751|238|469| 
|268|941|573| 
+---+---+---+ 
|972|164|835| 
|683|759|124| 
|514|823|769| 
+---+---+---+ 
Puzzles: 1, Solved 1, Unsolved: 0

More Related Content

Viewers also liked

Viewers also liked (17)

P3
P3P3
P3
 
P2
P2P2
P2
 
Lo39
Lo39Lo39
Lo39
 
Lo37
Lo37Lo37
Lo37
 
E7
E7E7
E7
 
T4
T4T4
T4
 
P4
P4P4
P4
 
T2
T2T2
T2
 
Lo48
Lo48Lo48
Lo48
 
E10
E10E10
E10
 
Lo27
Lo27Lo27
Lo27
 
T3
T3T3
T3
 
P5
P5P5
P5
 
T1
T1T1
T1
 
E9
E9E9
E9
 
E8
E8E8
E8
 
Lo17
Lo17Lo17
Lo17
 

Similar to P1

final presentation of sudoku solver project
final presentation of sudoku solver projectfinal presentation of sudoku solver project
final presentation of sudoku solver projectArafat Bin Reza
 
1 ECE 175 Computer Programming for Engineering Applica.docx
1  ECE 175 Computer Programming for Engineering Applica.docx1  ECE 175 Computer Programming for Engineering Applica.docx
1 ECE 175 Computer Programming for Engineering Applica.docxoswald1horne84988
 
Discussions In your own words (75-150 words)Due Sunday, May .docx
Discussions     In your own words (75-150 words)Due Sunday, May .docxDiscussions     In your own words (75-150 words)Due Sunday, May .docx
Discussions In your own words (75-150 words)Due Sunday, May .docxedgar6wallace88877
 
Unit I - 1R introduction to R program.pptx
Unit I - 1R introduction to R program.pptxUnit I - 1R introduction to R program.pptx
Unit I - 1R introduction to R program.pptxSreeLaya9
 
Artificial intelligence - python
Artificial intelligence - pythonArtificial intelligence - python
Artificial intelligence - pythonSunjid Hasan
 
Hey i have attached the required file for my assignment.and addi
Hey i have attached the required file for my assignment.and addiHey i have attached the required file for my assignment.and addi
Hey i have attached the required file for my assignment.and addisorayan5ywschuit
 
Mastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loopsMastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loopsRuth Marvin
 
c++ Project list
c++ Project list c++ Project list
c++ Project list NUST Stuff
 
Amcat automata questions
Amcat   automata questionsAmcat   automata questions
Amcat automata questionsESWARANM92
 
Amcat automata questions
Amcat   automata questionsAmcat   automata questions
Amcat automata questionsESWARANM92
 
Sudoku strategies richard dickerson
Sudoku strategies richard dickersonSudoku strategies richard dickerson
Sudoku strategies richard dickersonRodrigo
 

Similar to P1 (20)

Sudoku solve rmain
Sudoku solve rmainSudoku solve rmain
Sudoku solve rmain
 
final presentation of sudoku solver project
final presentation of sudoku solver projectfinal presentation of sudoku solver project
final presentation of sudoku solver project
 
Sudoku solver ppt
Sudoku solver pptSudoku solver ppt
Sudoku solver ppt
 
1 ECE 175 Computer Programming for Engineering Applica.docx
1  ECE 175 Computer Programming for Engineering Applica.docx1  ECE 175 Computer Programming for Engineering Applica.docx
1 ECE 175 Computer Programming for Engineering Applica.docx
 
Discussions In your own words (75-150 words)Due Sunday, May .docx
Discussions     In your own words (75-150 words)Due Sunday, May .docxDiscussions     In your own words (75-150 words)Due Sunday, May .docx
Discussions In your own words (75-150 words)Due Sunday, May .docx
 
ForLoops.pptx
ForLoops.pptxForLoops.pptx
ForLoops.pptx
 
Unit I - 1R introduction to R program.pptx
Unit I - 1R introduction to R program.pptxUnit I - 1R introduction to R program.pptx
Unit I - 1R introduction to R program.pptx
 
Cmgt 410 week 3 final draft
Cmgt 410 week 3 final draftCmgt 410 week 3 final draft
Cmgt 410 week 3 final draft
 
Artificial intelligence - python
Artificial intelligence - pythonArtificial intelligence - python
Artificial intelligence - python
 
tick cross game
tick cross gametick cross game
tick cross game
 
Hey i have attached the required file for my assignment.and addi
Hey i have attached the required file for my assignment.and addiHey i have attached the required file for my assignment.and addi
Hey i have attached the required file for my assignment.and addi
 
Mastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loopsMastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loops
 
The Egison Programming Language
The Egison Programming LanguageThe Egison Programming Language
The Egison Programming Language
 
mini project new.pptx
mini project new.pptxmini project new.pptx
mini project new.pptx
 
c++ Project list
c++ Project list c++ Project list
c++ Project list
 
FULL DOCUMENT.docx
FULL DOCUMENT.docxFULL DOCUMENT.docx
FULL DOCUMENT.docx
 
Make a match3
Make a match3Make a match3
Make a match3
 
Amcat automata questions
Amcat   automata questionsAmcat   automata questions
Amcat automata questions
 
Amcat automata questions
Amcat   automata questionsAmcat   automata questions
Amcat automata questions
 
Sudoku strategies richard dickerson
Sudoku strategies richard dickersonSudoku strategies richard dickerson
Sudoku strategies richard dickerson
 

More from lksoo

More from lksoo (13)

Lo43
Lo43Lo43
Lo43
 
Lo12
Lo12Lo12
Lo12
 
L10
L10L10
L10
 
L9
L9L9
L9
 
L8
L8L8
L8
 
L7
L7L7
L7
 
L6
L6L6
L6
 
L5
L5L5
L5
 
L4
L4L4
L4
 
L3
L3L3
L3
 
L2
L2L2
L2
 
L1
L1L1
L1
 
E6
E6E6
E6
 

Recently uploaded

Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseAnaAcapella
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxAmanpreet Kaur
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 

Recently uploaded (20)

Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 

P1

  • 1. Project 4: Sodoku Solver Deadline: 11:30am, October 19th Read this document carefully and completely before you attempt to solve programming project 4. Description: It is a popular logic-based number placement game. The aim of the puzzle is to enter a numerical digit from 1 through 9 in each cell of a 99 grid made up of 33 sub grids (called boxes). The game starts with various digits given in some cells (the givens). When finished, each row, column, and 3x3 regions must contain all 9 digits with no repetition. Completing the game requires patience and logical ability. Here is an interesting site if you would like to try and play the game http://www.dkmsoftware.com/sudoku/ http://www.sudoku.com/ There are 3 simple rules you must follow when playing Sudoku. Fill in the grid so that 1) every row 2) every column 3) ever 3x3 box contains the digits 1 through 9. • row: This is a row that is 9 cells wide. A filed row must have one of each digit. That means that each digit appears only once in the row. There are 9 rows in the grid, and the same applies to each of them. • column: This is a column, 9 cells tall. A filled column consists of having one of each digit just like the row. This means each digit will appear only once in the column. There are 9 columns in a typical Sudoku grid, and the same applies to each of them. • box: This is a box containing 9 cells in a 3x3 layout. A filled box consists of having one of each digit just like the rows and columns. This means that each digit appears only once is in the box. There are 9 boxes in a typical Sudoku grid, and the same applies to each of them.
  • 2. You will notice that the maroon colored digits are the “givens” and the gray shaded digits are the possible digits that can be added to the row, column or grid to satisfy the 3 rules above. Unsolved Solved Implementation: • bool Solve (): o You will implement a solve() function to solve your Sudoku grid. Your solve function should a recursive function, meaning that this function will call itself continuously until the game has been solved. Each recursive function will try different values applying each of the 3 rules and return a bool back to itself. If a FALSE is returned then the puzzle cannot be solved, and if a TRUE is returned the puzzle is solved. When your solve function has completed solving the game, your program will save the contents of solved or unsolved Suduko board. • Save (): o The save function will print the contents of solved Suduko board to the screen followed by solved. If the game cannot be solved then your program should print out what it had completed up until the point it determined the game is unsolvable followed by unsolved. • ostream operator o You will want to overload an ostream’s operator so that you can display a user defined object. Here is an example of overloading, http://gethelp.devx.com/techtips/cpp_pro/10min/10min0400.asp • You will also need to implement and default constructor, a copy constructor, a destructor and an assignment operator for your objects.
  • 3. Your projects directory structure: • The same as described in project 3. You must comment your code using Doxygen. We will read you code using Doxygen generated documentation. • Running make should produce the prj_4 executable under the bin directory. Running ‘doxygen’ with the included Doxyfile should produce documentation under your doc/html directory • Your project should be up to date on the svn server for checkout when completed Getting Started: • svn checkout https://svn.cs.fsu.edu/repos/teamXY/prj_4 o Will be available shortly after midterm • Familiarizing yourself with the game and its rules at one of the websites listed above. • Read in input from file and populate your data structure to hold the values. o Consider using a 2D array and for each element in the array have a vector. Once you understand the rules, you will see that for every blank spot in the Sudoku board you will have a possible of 1-9 candidates to try. And whether those candidates work or not will depend upon the three Sudoku rules. So your vector will contain initially values 1 – 9 and as your populate your board you will update those values in the candidate vector for each cell in your Sudoku board. • Your solve function will be a recursive function that will call itself and try new values for each spot in the Sudoku board until all of the 3 rules are satisfied. o Consider perhaps making copies of your Sudoku objects and updating the candidate vectors of the board to reflect the new number that you have chosen.
  • 4. Input and Output Format: Input: • Your program should take in input file containing the rows of initial information to populate your sudoku game to be solved. • usr@linrprog4:~/prj_4/bin/ prj_4 sudoku_input1 o Your input file should be in the following format. ********* 8**3*5**2 **6***9** *4*5*6*8* 7*1***4*9 ***9*1*** 97**6**35 **3***1** **4*2*7** Output: • Your program should output either the solved or the unsolved sudoku. o +---+---+---+ |425|697|318| |897|315|642| |136|482|957| +---+---+---+ |349|576|281| |751|238|469| |268|941|573| +---+---+---+ |972|164|835| |683|759|124| |514|823|769| +---+---+---+ Puzzles: 1, Solved 1, Unsolved: 0