Wednesday, November 2, 2016

Reflection of class on Nov. 1st
  In last class, I have leant about how to use the input function to collect text input from user, add notes to statements with a hashtag, join strings by using + to create an interactive program. But I know it was not the real interactive program because it was not logical enough though it was a narrative program. So, today I learned how to add logic to programs by following the example of Norwegian Blue parrot game in chapter 4 and did some relative practice in challenges.
  At first, I opened a new text editor window by pressing ‘Control + N’ and added necessary information like title, author and goal of parrot game as notes for other potential editors to help them understand this game. Then, I displayed the title and instructions by using print statement to show the basic rules of game for players to play. Well, there was a very useful function called String Literals that could hold multiple lines of text and that appeared exactly as I typed them in the text editor when they were displayed on the screen. There is a gap between dream and realistic, but there isn’t a gap between interface of editor and user by utilizing String literals because “what we see is what we get”. As a trial, I typed an expressive parrot image which was consisted of ASCII characters on screen. What a fabulous image it was on the screen after I pressed F5 to examine the result, it would play an important role to attract players to play this game.
  Additionally, I added if statements to respond right or wrong to players’ answer and print relative prompt messages to players as visual feedback. Seems like C language, the if and else condition line should end with a colon and I needed to use the double equals sigh to check the equality of the condition as a special operator, not the single equals sigh.
  Then, I should add while loops to repeat the same operation automatically. The core points here were loop body which included the same operation that should be repeated and judgement statement to detect if the loop body could be execute continually. And each line of codes in the loop should be indented four spaces from the left so that they could be executed normally, otherwise they would be out of the loop and there would be an error displayed on the screen.

  Well, I think I can design my own simple interactive program now by adding logic into it though I really don’t like add external notes on each module of my program. Of course, they are necessary for later examine and debugging to the finished program.

1 comment: