Tag Archives: #sudoku

Proyecto Final – SUDOKU

1017

El proyecto final de la materia consiste en la programación de un juego de Sudoku; para poder realizarlo tuvimos que aplicar TODOS los conocimientos aprendidos durante el curso, desde el uso de cout hasta la implementación de vectores y lectura de archivos.

Para explicar más el proceso de la elaboración del Sudoku hice un video en el cual detallo cada acción involucrada en el desarrollo del juego. Aquí puedes encontrar el video:

https://youtu.be/5uSVZKGnAvM

Así mismo, en el siguiente link puedes ver el código del Sudoku:

https://github.com/kenwbauer/HectorTania/blob/master/sudoku.cpp

Finalmente, utilizamos las siguientes páginas para obtener información sobre el Sudoku:

http://platea.pntic.mec.es/~ablanco/gi/tecnicasudoku.htm

http://www.kakuro.com.ar/historia-sudoku.htm

¡Bonito día! 🙂

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

Final Project (Sudoku)

Hello everybody:

We are finally done with our final proyect. 

At the beginning I thought that creating a sudoku was going to be very complicated, but then, Ken told me that the key on this was to divide the project in small different pieces and work on them one by one. In our case, those little pieces were functions that we implemented in our code.

Our code has ten different functions (not including our main function). The reason why we have all those functions, is beacuse we decided it was going to be easier if we worked on one condition at a time. We have a function that checks for the row in our table, another one that checks for the column, another one for the quadrant, another one for the range, another one that prints the board, etc. 

I think the most complicated part was to understand and visualize what a double vector is, because the project is literally based on that concept. 

Complications:

There were three steps during the creation of the sudoku that were a bit more complicated than the others: checking for the quadrat, implementing colors, and correcting our “chekingrow” function.

We we implemented the function that cheks for the row, it was working but not as we wanted it to. If the number was already in that row, a message was sent to the user, but the number was still placed in that invalid space. The problem was that our condition was not correctly placed, so the complicated part here was identifying where the condition should have been.

The second difficult part of this project was checking the quadrant of the number. At the beginning I had no idea of how to do it, but Ken explained us (Juan and me) that it had to be done by dividing and multiplying the position by/times three and then creating a double for loop that checked only that specific quadrant. The complicated part here was not creating the function, but being creative in order to know how to do it. 

Finally, the most complicated of the three was implementing colors. Until now,  I had never used colors in C++, so it was a bit complicated to find the correct way to implement them. The syntaxis was not difficult, the real challenge (at least for us) was to find the information on how to do it. 

 

My partner for this project was Juan Mercado, and I had a very good experience working with him. It was very easy to organize the project, and we were always telling the other what we were doing and what problems we were having. I strongly recommend him as a project partner. 

 

As a conclution, I personally think this was a very good project because it makes you realize you can actually create cool stuff with programing. At the beginning I thought it was going to be tyring and complicated, but once I started working on it, I realized it was actually very interesting. By the way, it is just amazing when one of your functions does what you want it to do. 

 

Here´s the link of our code

https://github.com/kenwbauer/EduardoJuan/blob/master/sudoku.cpp

 

1017

#TC1017


#TC1017

#TC1017

Este es el link para mi proyecto final y un corto video de que hice.

https://github.com/kenwbauer/JorgeLuis/blob/master/ProFinal
https://youtu.be/JkqDQPqn3V4

También unas referencias que me facilitaron hacer el proyecto.

Cplusplus.com,. (2015). Arrays – C++ Tutorials. Retrieved 4 May 2015, from http://www.cplusplus.com/doc/tutorial/arrays/

Cplusplus.com,. (2015). Input/output with files – C++ Tutorials. Retrieved 4 May 2015, from http://www.cplusplus.com/doc/tutorial/files/

Downey, A. (1999). How to think like a computer scientist : C++ version. [S. l.]: SoHo Books.

Tldp.org,. (2015). Colours. Retrieved 4 May 2015, from http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html

Saludos TC1017

Jorge Cervantes.

Sudoku

PROJECT

   #WorkHard

Hey blogers!!

Finally we have finished our and we happy to share it with you

the most difficult part in my opinion was to catch a logical way to write the code;

we had many difficulties but the program is functional now; It just have some stetic details to fix.

Check our code and try to win!   

 

Link: https://github.com/kenwbauer/JairArmando/blob/master/final%20sin%20colores

Untitled

Reporte

Hola a todos, al parecer tenemos listo nuestro sudoku, pulimos detalles que teníamos pendientes (están en mi reporte anterior) y todo parece indicar que nuestro programa corre sin problemas. Puedes ver nuestro código en: https://github.com/kenwbauer/SamirJoseLuis/blob/master/sudoku.cpp

José Luis Enríquez Flores

A01630238

Jorge Samir Godinez Lara

A01630155

Reporte Sudoku

Esta semana le pusimos lineas horizontales y verticales para separar los numeros por cuadrantes, y hemos tratado de poner colores a los numero pero aun no logramos ponerlos, solo a las lineas de los cuadrantes. Lo siguiente que haremos sera checar las columnas y hileras, asi como el usuario pueda escribir los numeros que desea ingresar. 

PROJECT

 #SUDOKU

Hey everybody! 

We have been working on the SUDOKU, currectly we have the basic code and now it just have some details to fix. One of the most difficult parts in my opinin was to print the text in color because we tried many different ways but it didn’t work until yesterday!!!

I’ll continue submmiting our progress.

 

If you have the same problem in cygwin try this:

 

<iostream>

using namespace std;

 

RED “x1b[31m”

GREEN “x1b[32m”

YELLOW “x1b[33m”

BLUE “x1b[34m”

PURPLE “x1b[35m”

SKY “x1b[36m”

WHITE “x1b[37m”

RED_BK      “x1b[41m”

 

int main()

{

cout<<RED_BK<<endl;

cout<<RED<<“Hello, World”<<RED<<endl;

cout<<GREEN<<“Hello, World”<<GREEN<<endl;

cout<<YELLOW<<“Hello, World”<<YELLOW<<endl;

cout<<BLUE<<“Hello, World”<<BLUE<<endl;

cout<<PURPLE<<“Hello, World”<<PURPLE<<endl;

cout<<SKY<<“Hello, World”<<SKY<<endl;

cout<<WHITE<<“Hello, World”<<WHITE<<endl;

return 0;

}

Reporte Sudoku

Esta semana estuvimos trabajando en el sudoku, se realizaron varios cambios, se agregaron librerias de color y se pusieron a funcionar la mayoria de las opciones e incluso fuimos a vistar a Ken para resolver algunas dudas porque estabamos un poco perdidos.

Falta hacer que los valores del archivo de texto queden estaticos y afinar pequeños detalles.

Los modificaciones del codigo las pueden consultar en: https://github.com/kenwbauer/SamirJoseLuis/blob/master/sudoku.cpp

José Luis Enríquez Flores

A01630238

Jorge Samir Godinez Lara

A01630155