Final Project! Snake game lml

--Originally published at Programming the city

Hello guys.

My friend Gustavo Hinojosa and I did the snake game, like the one that was installed in the Nokia 3310.

First of all, we tried to make the code in atom and run it in the cygwin terminal, but the specifications of the coordinates were wrong. Cygwin didn’t respected the specifications, that’s why we started doing the code in the IDE named CodeBlocks.

First of all we added all the libraries, “Windows.h” was to include the specifications of the coordinates. Later, we added all  the variables and the keys of the board to indicate which buttons the program had to take.

Then, we created the functions, this was the hardest part and the most difficult too. First we created the gotoxy function, We could did that function because we asked for help in Google, this function helped us to make the coordinates specifications.

Later that day, we created another eight functions, pintar: it was to build the square where the snake is eating, guardar_posición: it is to sabe the position where the snake crashed, dibujar_cuerpo: is to créate the whole body of the snake, teclear: is to indicate which buttons we needed to use, cambiar velocidad: is to increase the speed of the snake every time it eats,  comida: is to put a random place for the food, game over: is to end the game and puntos: is to show the score the user has done.

Finally we created the main function with a small menu which included an image of the snake and the options “1. Jugar   2.Salir” and after that, we added the functions.

Here is the amazing code!

1

2

3

 

4

And here is the snake Game!

6

7

8

 

 

 


YO SOY 196

--Originally published at Programming the city

Finally I could did the code “Yo soy 196” this has been the most difficult WSQ I have ever done. Thanks to my classmate and friend Fabrizzio who helped me with this.

I really liked this code because it had me thinking many hours and also because it was a big challenge to work with extra libraries and BigIntegers variables, and if you want an advice, just check what Fabrizzio posted on YouTube, it will help you a lot and make this code as your heart and brain tells you to do it..

Don’t forget to add the libraries!!!

a

a

And the result is…

a


WSQ10-Babylonian Method

--Originally published at Programming the city

Hey there guys!

Today I discovered another way to get the square root of a number; this way taught me that it is not neccesary to have a calculator to make different kind of operations and also I learned that we have problems every day but there are thousands of ways to solve them:).

The first advice for you to make this code is to include the cmath libray: this is because of the math operations we will need.

After that I added 6 variables which will help me to make the babylonian method. The first while is to know how many digits are in the number, the next part is when cont2 = cont-1; this is becaues after that I make the first operation of the babylonian method before the for, and as you can see, you have to make 1 less operation comparing to the number of digits of the number. For example if the number is 125348, it has 6 digits, so you have to make 5 operations of the babylonian method.

The las part, when I make the for, is to make the last 4 operations of the babylonian method.

And that’s it!

a

And the result is:

?a


WSQ09- Multipart Data and files

--Originally published at Programming the city

Hey there!, basically this code shows you whatever you wrote in a text file, it shows you line  by line the words of a text file.

First I added the fstream library, this allows you to read a .txt file. After that, I wanted the program to ask the user what song would he/she wants to see. The user has to type the name of the song in a string value, the if function reads the name of the song and finally, it sees the which file name is it and it opens the text.

The teacher told us to make a function, but this code Works the same way without a function needed.

Just look at the operations I made and how you open the file.

CODE:

aaa

Result:


Quiz-Fibonacci code!

--Originally published at Programming the city

Hello there! As usual, I  post the codes which the teacher tell us to do.

Today I created the Fibonacci sequence, but the user has to introduce the limit or the number which will be the limit of the serie.

This code was a Little harder than the others for me, but with the help of my good friend and classmate Gustavo Hinojosa, I could finally did it.

Here is the code

a

 

And here is the result:

a


Different course! #TC1017

--Originally published at Programming the city

Nowadays, us the students are use to learn by listening to the teacher the whole class, sometimes we catch what teachers want to teach us, sometimes not. But in this course, we have a diferente way of learning, actually the meaning is different too.

I guess the course is divided in two parts, the part that Ken teach us and solve questions, and the part we search, thing and program by ourselves. I really belive that if we have these two parts mixed, we will learn more than in the past way of learning.

Today I can say that this course is working, and I really like it, furthermore, the part we score ourselves works in a way we check if we are doing things right, and if we really need to improve our skills and also our BEHAVIOR.

?


Quiz 05, Amazing codes!

--Originally published at Programming the city

Hey there guys, I just finished the 5 codes of the quiz.

I was in trouble in creating the first two codes because I didn’t know what they were supposed to do. But I visited Ken’s office and then everything was clear.

I really liked this course, because c++ is a language too wide so you can do whatever you want to achieve.

Here is the firts code. Advice: Be careful in where do you type the printf’s or the couts.

a

Result:

a


 

Second Code: Remember to include the stdio.h library

a

Reslult:

a


 

Third code: You may think its too difficult to créate a triangle with letters ina c++, but what you just need to do is to press space and put the letters in shape.

a

Result:

a

————————————————————-

 

Fourth code: In this code, I did it in a larger way, but you can do it smaller as you want.

aa

 

Result:

a

 


Fifth code: This was the easiest code.

aa

Result:

a


WSQ07 – Lists lml

--Originally published at Programming the city

Hello there!

As usual, I post my codes here in programmingthecity, I really like the way we work in the course TC1017.

Well, this program was difficult for me, because I didn’t know how to make the lists, neither the arrays, but with the help of my teacher I could finally did it.

For advice, just be careful when making the lists and the math operations.

Here is the code.

wsq07

 

And the result is here.

wsq07

 

You can see these web pages helped me with the code.

 

https://www.programiz.com/cpp-programming/examples/standard-deviation


WSQ06 – Factorial Calculator

--Originally published at Programming the city

Today, I created a program where the user gives me a number and I calculate its factorial.

Now Im making every code with functions.

The only thing I used was a for and a loop, to ask the user if he or she wants to keep the program running or if he/she wants to get out of there.

Just for advice, becareful in where you type the {} the position matters a lot.


wsq06-1wsq06-1


And the result is

wsq06-1

 

I want to say thanks to my classmates and the people that helped me without realizing, like this two web pages:

 

https://www.trucoswindows.net/forowindows/temas/variable-a-usar-para-texto-c.52540/