iasteele

 

Mark

Page history last edited by mark 2 yrs ago

3/10/07

 

    Today, was the first day of the C++ programming enrichment.  Within this one class period, we have learned so much about programming basic applications.  For today, we spent the time working on our first game, a "guess the number" game.  Though it seemed very simple in appearances, the coding that backed up the "simple" game was a very complex and extensive coding.  Through this experience, I not only learned the how's of some elementary programming, I learned of the patience required after several times of frustrating debugging and correcting of the code. 

 

    To start off my learning experience, I was taught how to open up a new file.  Unilike a simple word file, there is a process, of selecting certain selecting of formats, and making a main within the formated file created.  Also, we learned some of the basic codes, such as printf which is what is used to make certain texts show up on the final products.  And also, we learned that programming is much like math, with integers and variables.  The code for integers is int, while the code for characters is char, combining these two into scanf() can enable several different functions to occur.  One of the most important things i learned from this experience today is that all this code will make a huge mass and mess, and that it is very important to organize it by indenting things and spacing everything out.  Overall, today's C++ experience was very beneficial and also interesting

 

 

3/17

    Within this week's five hour class/ C++ experience, we learned so much.  We learned so much that i can barely remember many portions of the lesson.  In today's lesson, we conpleted 3 different programs and started a fourth even more complex program.  The first program which we called Count, which was basically as stated in its name, a counting program.  This program allowed the user to insert a number and the program would count all the way up to the number inserted.  The second program was called Calc.  This is a calculator program that could compute simple expressions containing multiplication, addition, subtraction, and division.  The third completed program completed was called Hello.  This was a name and age program, where an user would insert a name and number, and the program will print it onto the screen.  The fourth program that we started but did not finish yet was a C++ version of BlackJack.

 

   Though these programs completed simple tasks, the coding for these programs were quite complex.  In the coding prospective of today's lesson, we learned a string of code that is much more organized than the scanf code.  This code was called the for() code which is a looping code.  This code consists of 3 parts, the initialization, condition, and increment.  The initialization states the initial value, the condition is where and when the code will end, and the increment is the interval that the value increases by.  The value's increase will keep looping until it reaches the condition.  We also learned how to replace a bunch of integers or characters.  We did this by turning it into a string, using brackets like [].  We also learned how to convert integers into characters.  Together with these new strings of codes many new types of programs can be created.

 

3/24/07

Today was one of the most confusing and hardest class to keep up with.  I arrived 3 hours late today due to an orchestra seating audition.  For the entire 5 hours or 2 hours that I was here, we worked on the BlackJack game that we started last time.  Because I came late today, I missed a large portion of the coding that was continued during the beginning of the class.  Therefore, I asked one of my classmates to copy the coding that i missed onto an e-mail and sent it to me so I could catch up.  Even though I got the majority of the code, I still had trouble keeping up because I did not understand a large portion of the coding. 

 

For the portion that I did understand, I understood the overall objective but not too much into the detail.  We set up perameters for the cards.  We gave the user the option of whether or not to hit or stand.  Then, since these were only characters, we had to give things that would happen if they hit the keys h or s.  If 'h', the program will give the player another card and calculate the result.  If 's' the game just ends right there.  We also learned a string of code that would shuffle the cards, therefore every time the game is played, the result will be different.  Next week, we will continue on this game and add coding to make the program calculate of the player wins compared to the computer.

 

3/31

Today, we finally finished the game that we have been working on for 3 weeks, BlackJack!  In the non-coding aspect, we learned how to end the game if the player choses to, how to hide one of the dealer's card values, and, one of the most important parts, how to place the bet during the game, and how to calculate the score.  Another important aspect of the game is that we coded the game so that Ace can be one as well as eleven.  Throughout the coding process there were portions where we were completely lost.  One part, even the teacher was having trouble, and we could only copy and follow along cluelessly.  But besides that, the overall coding of this game went pretty smoothly.

 

In the more technical aspects, even the simple functions were pretty complicated in the coding aspects.  We started today's classd by trying to program the score keeping.  For this part, we coded the score as an integer with an initial value.  When the player wins, the return value is 1, but when he/she loses the return value is 0.  The actual return value isn't just one 1, or 0, the actual return is whatever the player bets and the 1 just represents the gain.  On the other hand, 0 is not that you don't gain and you don't lose, it means that when you bet, you pay the value that you bet but when you lose, you gain nothing in return therefore it is an overall loss.  To program the ace, we coded the program to determine whether or not to make the value 1 or 11.  If the sum value of all the cards that the player has is less than 21, then the value of the ace is 11, but if the sum value of all the cards is greater than 21, then the value of the ace is considered 1 by the program.  The coding process of these functions of the game is very complex and requires the change of the code in several different places in the large page of code.

 

 

Comments (0)

You don't have permission to comment on this page.