Saturday, April 19, 2014

CONTEMPORARY FIGURE POST






McConlogue to the left and Grand to the right.




Right now in the computer programming world there are two pretty popular individuals, not so much for their contributions towards computer programming but the message they deliver. Patrick McConlogue and Leo Grand are two computer programmers. The thing is, grand wasn't always a computer programmer. In 2011, Grand lost his job at MetLife then his home. In August 2013, while homeless, Grand was offered the choice between $100 or coding lessons by Patrick Mconlogue. Grand took the lessions. Grand was able to learn coding, which lead to the launch of his "Trees for Cars" mobile app. The application had the aim of being environmentally beneficial. What makes the story of these two individuals so influential is the idea that if you give someone the opportunity to make some sort of change in their life, and they take it... Then it's all worthwhile. Just as EOP students are typically those who people think "Aren't fit for college" some might say "All homeless people are mentally ill, lazy, and unintelligent" which is not true at all. Grand has shown that it doesn't matter what your living arrangements are like as long as you've got the mindset and the will to do something. And that really stood out to me.









(I couldn't really find an academic source for this story but this is the link where I got it from http://journeymancourse.com/)

Friday, April 18, 2014

Historical Figure in Computer Programming





Grace Hopper


This particular post was a bit more difficult than the others. In the development of computers, it has always been uneven. This is due to the fact that the creation of the computer can not be tied to a single name. The computer has had multiple pioneers. It is for that reason that I chose something a little more specific in this particular field of computers. I had done a little digging on pioneers towards computer programming, since I'm learning a programming language. Grace Hopper was an American computer scientist, whom I consider a pioneer in the field. Grace ended her career in the Navy with the rank of admiral, but she is best remembered for her work in computer programming. Grace was one of the first programmers of the Harvard Mark I computer and developed the first compiler for a computer programming language which is huge. Her creation allowed programmers to use near English instead of binary code(machine code..1001001). She also pioneered the concept of a library of subroutines that different programs coule call upon(in python we'd call these functions), rather than coding the same thing again and again with each program. After Grace's contribution to computer programming, programming became a story of higher level languages that allowed computer programmer s to focus more on creating new applications than on learning and composing in machine code. Grace is also noted as the person who coined the term 'debugging' when it came to fixing their computer after a technician found a dead moth in the relay of the Harvd Mark II electromechanical computer in 1947. It has been noted that Grace was did not coin the term debugging and that Thomas Edison did first.











http://web.mit.edu/invent/iow/hopper.html
http://theinstitute.ieee.org/technology-focus/technology-history/did-you-know-edison-coined-the-term-bug
http://www.history.navy.mil/photos/pers-us/uspers-h/g-hoppr7.htm

BOOK REVIEW

Invent Your Own Computer Games with Python
by Al Sweigart

This book is definitely appropriate for someone who is interested in learning python, who have not before. At this point, I can say I have not finished the book, but so far everything is explained right from the ground up; in an interesting style that does not really dumb down too much. The main thing that irked me just a little was the fact there were not any exercises after the lessons. The new information is presented in each chapter, but because their are no exercises, the material is not reinforced. I find learning python is one of those skills you learn by doing, meaning type every line of code out. Most beginner programmers tend to copy and paste the source code of each program after going through the explanation, rather than trying it out and that is usually it. In my opinion that is really not the best way to go about learning programming, I have tried that in the past, it does not work. Other than that, in terms of the actual language of Python, not all aspects of the language are described; only the parts that are absolutely necessary to know how to create games. The next book I get will probably be more about the language of python, however this is definitely a great first book to jump into the language with.


Thursday, April 17, 2014

Weekly Reflection #11

This week I was introduced to a few new methods and functions that come with python. I couldn't quite wrap my head around some of the information given like augmented assignment operators and string interpolations as I didn't really finish the chapter but I still learned quite a bit. The concepts in this chapter were more shortcuts to some of the things I'd already known from the previous chapter, but they definitely made typing code easier. I learned a new game, I'd never heard of called Bagels. Bagels is a simple game you play with your friend. Your friend thinks up a random 3 digit number with no repeating digits, and you have to guess the word. After each guess, your friend gives you clues on how close your guess was. If the friend tells you 'bagels', that menas that none of the three digits you guessed is in the secret number. If your friend tells you 'pico' then one of the digits is in the secret number, but your guess has the digit in the wrong place. If your friend tells you 'fermi' then your guess has a correct digit in the correct place. However, even if you get a pico or fermi clue, you still don't know which digit in your guess is the correct one. You can also get multiple clues after each guess('fermi pico pico').
Example of the game in python












The process in designing this game was the same as the others starting with a flow chart. One of the important functions I learned this week was getSecretNum() which will generate the random secret number for this game. This chapter introduced a few new functions and methods (random.shuffle(), sort(), and join()), along with a few shortcuts. I didn't get to the other stuff though.

Sunday, April 13, 2014

Weekly Reflection #10

This week I got to take what I learned last week and apply it to the creation of a tic tac toe game. This tic tac toe game was different from the hangman game where you have to guess the word. This chapter ventures into simple artificial intelligence. An AI(Artificial intelligence) is a computer program that can intelligently respond to the player’s moves. This game didn’t introduce any complicated new concepts. As we already know tic tac toe is a simple pencil and paper game played between two people, one is X and the other is O. On a simple nine square grid, the players can take turns placing their X or O on the board. If a player gets three of their marks on the board in a row(whether it be straight or diagonally), they win. Most games of tic tac toe end in a draw with neither players having three marks in a row. In this chapter, instead of having a second human the AI made moves against the user.


In the previous chapter I learned about ascii art, along with various string methods, and elif statements. Before I could actually utilize the AI I had to define a function called drawBoard. This function does exactly what the name implies. What good is tic tac toe without a board? I had to use ascii art to draw up the board.



The ascii art in code












After coding in the art you'd get a board that looks like this:
   |   |
   |   |
   |   |
-----------
   |   |
   |   |
   |   |
-----------
   |   |
   |   |
   |   |




But before I get ahead of myself, just like a couple chapters back, I actually had to use a flowchart, because programming an AI no matter how simple, isn't something that should be done without some sort of organization, you'll likely end up with bugs later on.












After I had that established, the reason I had to draw the board first was because I needed some sort of interface. Next I had to make the board represent a variable. With pen and paper playing tic tac toe, you'd just put the X or O in the empty space, in python, that empty space is represented by a list of strings. Each string represents one of the nine positions on the board. To make it easier to remember the location of each position the number pad was used. 

After I had the board layout figured out. The rest was pretty much just me following the flowchart layout. Ask a player's letter, randomly generate who goes first, wait for the move to be made, and after that constant checks of which player won. Creating a program that can play a game really comes down to carefully considering all the possible situations and outcomes. It's not so much the AI is thinking for itself it's really just using predetermined situations which you code for it. Compare to something like chess or checkers, tic tac toe is simple because there aren't too many outcomes. This AI just blocks the players move if the player is about to win, and tries to win if put in a position to. The AI chooses any empty space on the board, then the center, then the side.



Sunday, April 6, 2014

Weekly Reflection #9

In this chapter, I made use of the flow charts from the previous chapter to start making my hangman game. The hangman game consist of ascii art utilizing Multi-line strings. 
HANGMANPICS = ['''

  +---+
  |   |
      |
      |
      |
      |
=========''', '''
...the rest of the code is too big to show here...

Above is an example of what hangman would look like using ascii art(text art). This chapter was really long and several new concepts(Methods, for loops, Else-if statments..etc) which I'm still trying to wrap my head around where introduced. Methods are just like functions, except that are associated with values. Methods return values just like functions return values. For loops iterate over the items in a list. The range() function is often used with for loops because it's an easy way to create  lists of sequential numbers. Else-if statements, used in python as elif will execute their block if their condition is true and the previous if and elif conditions are false(booleans, true or false conditions). So far, Hangman has been the most advanced yet introduced in the book. With this known, I definitely understand why it's a good idea to use a flow chart.

Wednesday, March 26, 2014

Weekly Reflection #8

Just as I'd said last week, this week I actually don't have anything to blog about. Chapter 8 stressed the importance of using flow charts to plan out your game. Hangman was used as an example because hangman, although very simple, it is very complex when learning to program the game.

Although part of me feels like this was a waste of a chapter(like I could have googled being more efficient with programming), I do also feel it will be very beneficial later when I do actually build up and work on a project. Being a visual learner, it might not be a bad idea to use flow charts, instead of jumping into the code then being lost later, I could go back to my chart so I know what I need to do, and in what order.