Friday, March 25, 2011

Mar. 25

I really didn't get to finish the game I was trying to create. When working on it, I got stuck on the part when I had to change distance to hit and then put in the code and make it pass the doctest. Every time I tried i always got 2 out of 4 fail. I really didn't know that making a game would have been this difficult.

def hit(bx, by, r, px, py, h):
"""
>>> hit(760, 100, 10, 780, 100, 100)
False
>>> hit(770, 100, 10, 780, 100, 100)
True
>>> hit(770, 200, 10, 780, 100, 100)
True
>>> hit(770, 210, 10, 780, 100, 100)
False
"""
The above was what I had to make pass the doctest. From my program that I'll be adding as the last part of todays blog message, I had put return (h <= by) and (bx <= r) and had to fit somewhere into the program that it would return true. Also with (h <=by) I had to make sure it told that the ball was between the bottom and the top of the paddle, and then for (bx <= r) I had to make sure that the horizontal location of the ball is less than or equal to the radius away from the front of the paddle.
http://dl.dropbox.com/u/24004516/pong2.py
The above link is my program.
So as Mr. Elkner said, come Monday hes gonna help me with this program. Also my homework for the weekend is to get a notebook for Monday.

1 comment:

  1. I have an important project for you. I am switching to the 3rd Edition of the textbook. I'd like for you to test it for me.

    Let's talk when you arrive today.

    ReplyDelete