Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with this C++ coding assignment. It is an object oriented assignment involving sudoku. Some code has been written already and I will

I need help with this C++ coding assignment. It is an object oriented assignment involving sudoku. Some code has been written already and I will attach the files that need implementation and coding. The instructions along with the code alreay given are below. The code already given has a main.cpp, sudoku.cpp, and sudoku.hpp.There is a written response to a similar assignment on chegg already but I am in need of further assistance. Please help!

image text in transcribed

image text in transcribed

image text in transcribed

main.cpp:

/**

* @brief Example driver program for class Sudoku

*/

#include

#include "sudoku.hpp"

/**

* @fn main

* @brief Creates two unsolved Sudoku objects (from text files),

* solves, and displays them

*/

int main(){

Sudoku sdku0("tests/0_sudoku_grid.txt");

std::cout

sdku0.Solve();

std::cout

std::cout

std::cout

Sudoku sdku1("tests/1_sudoku_grid.txt");

std::cout

sdku1.Solve();

std::cout

std::cout

return 0;

}

sudoku.cpp:

/**

* @brief Sudoku class implementation

*/

#include

#include

#include "sudoku.hpp"

Sudoku::Sudoku(std::string infile){

}

// Put documentation here

bool Sudoku::Solve(){

}

// Put documentation here

void Sudoku::locate_unsolved(int & r, int & c){

}

// Put documentation here

bool Sudoku::valid_row(int r, int val){

}

// Put documentation here

bool Sudoku::valid_col(int c, int val){

}

// Put documentation here

bool Sudoku::valid_box(int r, int c, int val){

}

// Put documentation here

bool Sudoku::valid_entry(int r, int c, int val){

return valid_row(r, val) && valid_col(c, val) && valid_box(r, c, val);

}

// Put documentation here

std::ostream & operator

}

sudoku.hpp:

/**

* @brief Sudoku class declaration, your implementation is up to you.

*/

#ifndef SUDOKU_H

#define SUDOKU_H

#include

#include

class Sudoku{

private:

// Helper functions if you need them, declare/implement more if needed...

bool valid_col(int, int);

bool valid_row(int, int);

bool valid_box(int, int, int);

bool valid_entry(int, int, int);

void locate_unsolved(int &, int &);

public:

// Required functions

Sudoku(std::string);

bool Solve();

void Save(std::string);

friend std::ostream & operator

};

#endif

Project 7: Sudoku Solver COP3330: OOP March 20, 2018 Problem 1. Sudoku 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 9 x 9 grid made up of 3x 3 sub grids (called "boxes"). The game starts with various digits given in some cells (the "givens"). When finished, each row, column, and 3 x 3 region must contain all 9 digits with no repetition. You will be implementing a twist on the original Sudoku game. In this modified version, the digits(1 9) will be entered in a 6x 6 grid, where no row, column, or 2 x 3 box. has a repeated digit. Some of the squares are split by a slash in which 2 numbers can be entered in the cell (the bottom always being the largest digit). In each 2 x 3 box, there are 3 cells that hold a single digit, and 3 that hold 2 digits, separated by a slash. To recap, there are 3 simple rules you must follow when playing Sudoku. Fill in the grid so that: 1. every row 2. every column 3. every 2 x 3 box contains the digits 1 through 9 7 Incomplete Grid Solution Grid Figure 1: An example Sudoku grid Project 7: Sudoku Solver COP3330: OOP March 20, 2018 Problem 1. Sudoku 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 9 x 9 grid made up of 3x 3 sub grids (called "boxes"). The game starts with various digits given in some cells (the "givens"). When finished, each row, column, and 3 x 3 region must contain all 9 digits with no repetition. You will be implementing a twist on the original Sudoku game. In this modified version, the digits(1 9) will be entered in a 6x 6 grid, where no row, column, or 2 x 3 box. has a repeated digit. Some of the squares are split by a slash in which 2 numbers can be entered in the cell (the bottom always being the largest digit). In each 2 x 3 box, there are 3 cells that hold a single digit, and 3 that hold 2 digits, separated by a slash. To recap, there are 3 simple rules you must follow when playing Sudoku. Fill in the grid so that: 1. every row 2. every column 3. every 2 x 3 box contains the digits 1 through 9 7 Incomplete Grid Solution Grid Figure 1: An example Sudoku grid

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

Database Concepts

Authors: David M Kroenke, David J Auer

6th Edition

0132742926, 978-0132742924

More Books

Students also viewed these Databases questions

Question

4. What will the team agreement contain?

Answered: 1 week ago