Final Project

1017

This final project was a great experience to use lots of funtions, loops, conditionals, vectors and arrays.  Everything that we learned through out the semester was really helpful to connect the ideas of the boardgame with functions that helped the user interact with the program.

We started our project by creating a sudoku board which was given in a text file. After giving the paramters to the program (from the text file) we desided to change some things from the board such as a row and a column of numbers for the user to give of the coordenates of the numbers inside the board. The purpose was to create a sudoku game, with enough functions to be able to write on it, erase from it (just the numbers given by the user), print the board as many times the user wanted to, restart the game as many times the function was called and also be able to quit the game. 

For the text format from the board, we used a series of conditionals including string files, using the numbers from the text file to add lines to it.
Originally the file was like this:

5 3 0 0 7 0 0 0 0

6 0 0 1 9 5 0 0 0

0 9 8 0 0 0 0 6 0

8 0 0 0 6 0 0 0 3

4 0 0 8 0 3 0 0 1

7 0 0 0 2 0 0 0 6

0 6 0 0 0 0 2 8 0

0 0 0 4 1 9 0 0 5

 

0 0 0 0 8 0 0 7 9

But after the modifications on the board that we created it looked like this:

In order to display the numbers like that and also display the data, we used a vector inside another to store the user’s choice. We also created functions to check if the number entered by the user was already in the same row or column and therefore, tell the user that the number entered couldn´t be registered. 

The same concept was used for numbers bigger than nine or smaller than 1. Whenever the user provided a number 9 then, the program displayed a mesage asking the user to provide a number within the parameters from the game. 

Of course in order for the user to understand the whole concept we displayed some instructions.

At the end of the code, are a bunch of conditionals which store the user’s choice (print, erase, write, quit, restart) in order to call our functions and display a message. 

Github link: https://github.com/carlosgreen/Sudoku_Caro_Carlos/tree/master

CC BY 4.0 Final Project by carlos green is licensed under a Creative Commons Attribution 4.0 International License.

Comments are closed.