-
Recent Posts
Recent Comments
Archives
Categories
Meta
Author Archives: rohdzaimar
#Mastery23 – Vectors
Comments Off on #Mastery23 – Vectors
Posted in Blogs, Syndicated, TC1017 Blogs
Tagged #Mastery23, #TC, #TC1017, Mastery
#Mastery22 – When to use what type of repetition algorithms.
Comments Off on #Mastery22 – When to use what type of repetition algorithms.
Posted in Blogs, Syndicated, TC1017 Blogs
Tagged #mastery22, #TC, #TC1017, Mastery
#Mastery18 – Nested Conditionals
Comments Off on #Mastery18 – Nested Conditionals
Posted in Blogs, Syndicated, TC1017 Blogs
Tagged #mastery18, #TC, #TC1017, Mastery
#Mastery17 – Switch
Comments Off on #Mastery17 – Switch
Posted in Blogs, Syndicated, TC1017 Blogs
Tagged #Mastery17, #TC, #TC1017, Mastery
#WSQ17 – FINAL ONE! SCILAB
Comments Off on #WSQ17 – FINAL ONE! SCILAB
Posted in Blogs, Syndicated, TC1017 Blogs
Sudoku Final Project
The semester is ending and our programming #TC1017 C++ course will come to an end; but not before we turn in our final project, which kept us busy for the last couple weeks. Something pretty curious happened to me during this course. I thought challenges were huge until i started getting into them and breaking them into little pieces which didn´t took me long to figure out. After what might have been a couple intense days of thinking and planning, my teammate and I got our sudoku working.
I´ll try to explain, in general terms, how our program works.
Vectors may exist in two dimensions. In this case, our sudoku board is simply a two dimensional vector that is modified by the main function in two sections: WRITE & ERASE. But before writing and erasing we had to check 4 things.
1: You may not modify or erase and original number.
First, we solved this creating a paralel clone vector that was not going to be modified during the game; so everytime the user wanted to erase or to write a new value inside the vector, the program was going to check whether that given position contained or not an original number that belonged to the level. If no original number was found, then the program could continue and write a new value, otherwise, a warning message would print. After talking to ken about a bug, he saw our huge conditonal code creating a huge, 81-slot, vector everytime the Write section was called. He said that our program would run slow and that there was an easier way and more efficient solution to our problem. Negative numbers. The program basically writes every original extracted input as a negative value, but prints the absolute value. So it checks if the value is or not negative. If is, then it is an original number, if not, then… No.
2, 3 & 4: May not repeat a number inside the same cuadrant, on the same row or on the same column:
Columns and Rows were easy to solve. Write a couple nested for loops that walk the conditional (looking for input) through each row or column given and return a boolean if found… The challenge was cuadrants. Since cuadrants were never defined in our vector, we had to create a function that returns the numbered cuadrant the input was located in (1-9), and with this location, a second group of nested for loops would look for a coincidence with the input given. All these where written inside a boolean function that returned TRUE if repeated.
All this development was written after we had checked the input was a number between 1 and 9 and that we read the initial menu input from the user (W for write, E for erase, Q for quit… etc) the last step was writing a function that told the user he had won and aesthetic details.
I´ll include some pictures and the link for the code in gitHub.
Rodrigo and JuanCarlos´s Sudoku Final Project
How the main menu looks like.
You can read how to play sudoku and some history of how sudoku was created.
Here´s the writing interface. The program asks for Row and Column. Notice the new “2”.
When you complete a level, the program lets you know right away!
Feel free to download the code and play it in your computer.
#TC1017
cheers.
Comments Off on Sudoku Final Project
Posted in Blogs, Syndicated, TC1017 Blogs
Tagged #FinalProject, #RodrigoJuancarlos, #sudoku, #TC, #TC1017
QUIZ 11
I struggled a little with question 2. I kind of managed to do it but it doesn´t work quite as i wanted it to work.
any way, here´s the link to it.ç
QUIZ 11
I struggled a little with question 2. I kind of managed to do it but it doesn´t work quite as i wanted it to work.
any way, here´s the link to it.ç
QUIZ 10
For quiz 10 I finally learned how to use vectors. (which i did not do during the rest of the semester.) I had to read a bunch of tutorials, but i just did not understand a thing. At the end, I found a couple videos that helped me through it.
Here´s my gitHub link with my files.
and here are the youtube links.
vectors as parameters in functions
Cheers.