Monday, November 14, 2016

Reflection of class on Nov 10th
  In last class, I have leant about how to use turtle module to output simple polygons and further complex combinations by inputting corresponding instructions in Python 3, but I cannot use turtle module to output another normal shape, circle.
  As we all know, if we want to design some fabulous artificial images, circle is the one of the most integral shapes so that I need learn how to output a circle by turtle module. Well, I have got it and utilize it with different polygons to design some interesting images like hexagram after today’s learning of chapter 2.
  In this chapter, circle command is the basic instruction that I can use it by adding radius and extent to create various circles and adding steps and radius to create different polygons which fits in a circle with different radius, that is, more steps the polygons have, more similar as the circle they are. In addition, I can set pen color before I draw the outline of shapes and add color to these various shapes by using begin-fill and end-fill commands which tell the turtle when to start filling from and then when to end filling. And I can also hide the turtle icon when the color filling is ending by using hide-turtle command.
  For repetition, I think I just need create a simple loop to achieve that so it’s not a problem, what I’m interested is the two different ways to describe turtle import. I always use “from turtle import *” command before I begin using turtle module because I don’t need to put “turtle.” in front of every function name which I want to use from the turtle module, it helps me a lot to save time on coding a procedure. But now I know this convenient way does have problem on using the same function name which may be imported from my own defined function. Instead, I can use “import turtle” directly to figure it out.

  As well, I finished all the challenges and created a complex hexagram as I have shown you in class later. But the only drawback was that I used too many repeated statements to achieve that. And I’ll try my best to improve the relative codes in next class.

Wednesday, November 9, 2016

Reflection of class on Nov 8th
  I’m sorry that I left for cafeteria 10 minutes earlier before the ending of regular class this morning, I just thought that I had finished chapter 1’s reading, relative practice and extra ideas implementation so that I could leave earlier. I’m so sorry about that.
  I remembered that you asked us to compare two books we have about the Raspberry Pi’s programming so that you could choose the better one for later students who would be involved in the same course according to our feedback. And I think I can give you some ideas about it now.
  In my opinion, Hello Raspberry Pi is better for shorthorn on Python programming who does not learn any similar programming course before because this book is so comprehensive as the guiding book in detail that you can follow the examples in the book and do same operations step by step in Python 3 to practice it. Just because of this, this book seems a little bloated for experienced learner on programming and it’s not so good for learners to think deeply of what they have learnt and consolidate it. But undeniably it’s a good book.
  For me, I prefer the new book Python: Programming Art which I used today because it is short but meaningful and useful for deeper learning. Well, the first chapter is just almost five pages but it took me about 4 hours to read and practice. At the beginning of this chapter, the author regularly wrote done essential goals as usual programming book, and you’ll be wrong if you thought you could just learn how to achieve these goals because this book is emphasizing deeper developing.
  I followed the example to type same codes in Python 3 and got the expected result as the book said, but I have to run the whole procedure again and again to monitor the track of turtle on screen and record it to make sure how the inside of different commands and values work. I also need to practice relative experiment to see what would happen if I change some original codes.
  And I also tried to work out meaningful ideas which are attached to the end of this chapter especially the idea 2. I spent almost one and a half hour on it because I have to figure out the right detailed value of each side of the house frame and angle of the roof’s hypotenuse and type in right codes to consist an entire program to get the same house image on the screen. I forgot how many times I pressed F5 to run the program for trial in this process but I remembered how I excited to see the image appearing on screen by following the moving of the little turtle.

  Absolutely, I worked out all the ideas correctly and did some personal change to see what happened later. I’m looking forward to learn next excellent chapter. And, best wishes to Anna and you.

Monday, November 7, 2016

Reflection of class on Nov. 3rd
  As we all know, most interactive games utilize powerful logical system to improve players’ participation and interest, that is, they provide different modes or choices for players to choose and each one could lead to a unique consequence just like the Raspi’s Cave Adventure.
  But designing a complex logical interactive game and achieve it by programming are not easy, we should consider comprehensively and be prudent to every line of codes we would create. So, we need to work out a plan by drawing a flow diagram for the whole game first to make the later programming process a little clearer. We can use a diamond shape to represent each decision, a rectangle shape to represent each consequence and a round rectangle shape to represent each final output of decision. Absolutely, these different shapes are connected by arrows which represent the possible available choices and point to the result of each choice.
  After the flow diagram was finished, we should use Python 3 to program the whole game. We are programming a complex logical game, so the if statement is the most important statement to help us get an anticipated result. But the problem is that sometimes players may input some unexpected information which could lead to the wrong result, so we need to use Boolean logic operators such as and, or and not to maximize the inclusion of if statement by correctly identifying the choice of players automatically.
  And what’s more, the simple if statement is completely not useful for the complex game, so we need to use nested if statements to check three or more available choose given by players. The key point here is that we must pay attention to the format of each line of nested if statements inside that each line of sub-statements should be indented four spaces from the beginning of if or elif command words. In addition, do not forget to add colon in the first line of each nested if statements otherwise the wrong mention sentence would display on the screen if we debug the program.

  Actually, what I feel excited in this chapter 5 is that I can make my own functions to organize code and avoid repeating codes by using def command. I can decide if my own function could output a return value or not and customize the details inside to achieve some particular purpose. I just define some particular functions and utilize them for practice when I explore the right cave in Cave Adventure. As you know, I spent a little more time on programming the right cave to practice my own functions. Fortunately, the entire program I have coded works very well. An excellent class!