Open main menu

CDOT Wiki β

Changes

BLAStoise

1,577 bytes added, 13:55, 10 February 2017
Assignment 1
== Progress ==
=== Assignment 1 ===
 
'''Sudoku Solver'''
 
Sudoku solver is a program that solves a sudoku puzzle. The user can input an existing file and have the program solve this, or can manually enter values to be solved. The sudoku puzzle is 9x9 in size. The data needs to be in a specific format for the program to work. There are 9 rows of values, with each cell/element in the row needing to be separated by a space. A 0 tells the program to solve this value.
 
Original source code can be found [https://github.com/shafeeq/Sudoku here].
 
 
To compile the program, in a terminal at the project location, enter
 
g++ -std=c++0x -pg solver.cpp checks.cpp checksolution.cpp -o Sudoku
 
This will create an executable file called Sudoku. -pg is used for creating a gmon.out file, which will allow us to profile the program with arguments.
 
This is the easy sudoku puzzle that will be running through the program first. The file is saved as 'puzzle' in the same directory.
 
0 6 0 0 0 0 9 7 2
0 5 0 0 0 2 0 0 3
0 7 0 3 9 0 5 0 0
2 0 0 0 0 5 4 0 8
0 0 0 0 0 0 0 0 0
3 0 1 8 0 0 0 0 6
0 0 4 0 2 3 0 8 0
7 0 0 9 0 0 0 2 0
9 2 5 0 0 0 0 4 0
 
Run the code with
 
./Sudoku puzzle
 
After the program is done running, the result is
 
0 6 0 0 0 0 9 7 2
0 5 0 0 0 2 0 0 3
0 7 0 3 9 0 5 0 0
2 0 0 0 0 5 4 0 8
0 0 0 0 0 0 0 0 0
3 0 1 8 0 0 0 0 6
0 0 4 0 2 3 0 8 0
7 0 0 9 0 0 0 2 0
9 2 5 0 0 0 0 4 0
1 6 3 4 5 8 9 7 2
4 5 9 7 1 2 8 6 3
8 7 2 3 9 6 5 1 4
2 9 7 1 6 5 4 3 8
5 8 6 2 3 4 1 9 7
3 4 1 8 7 9 2 5 6
6 1 4 5 2 3 7 8 9
7 3 8 9 4 1 6 2 5
9 2 5 6 8 7 3 4 1
 
'''Test Case'''
 
=== Assignment 2 ===
=== Assignment 3 ===
64
edits