Professional Documents
Culture Documents
COLLEGE OF ENGINEERING
Computer Engineering Department
FINAL PROJECT
Microprocessor System
NCP 426 – 2CP
Submitted to:
Submitted by:
Sibomet, Harold F.
20131200185
April 1, 2019
Code:
# Left and right elif ball.xcor() > 340 and ball.ycor() <
if ball.xcor() > 350: paddle_b.ycor() + 50 and ball.ycor() >
score_a += 1 paddle_b.ycor() - 50:
pen.clear() ball.dx *= -1
pen.write("Player A: {} Player B: os.system("afplay bounce.wav&")
{}".format(score_a, score_b),
align="center", font=("Courier", 24,
"normal"))
Output:
Discussion:
We named every objects in the game, first is the paddle A. After naming, we set
the speed, shape-size, color and draw line or guideline for our first object. After that we
just applied the same speed, shape-size, color and draw line to our second object which
we named paddle B. Ball is the name of our third object, we also copied the color, but we
input different speed and shape-size. After that we define the functions of each object in
this system.
The only function of paddle A and paddle B is to move up or down. We bind both
paddle A and paddle B to our keyboard. After that we create the loop of the ball, every
time the ball moves, it moves 2 pixels from x to y or y to x, and every time the ball goes
off the screen it goes back in the middle and move diagonally. After that we create a
paddle and ball collision, so that the ball bounces to the paddle A and paddle B. After that
we create a scoring so that we can see what the score is.
Conclusion:
I have learned a lot of things in this project. I have learned how to codes using the
Thonny Python software, and I managed to get familiarized on its system. I also learned
a lot about Raspberry Pi, in its components and each of its functions. We as a group faced
difficulties doing this project, we’ve had a hard time finding which or where in our codes
is wrong and needs to be corrected. Afterall we managed to over come the difficulties by
giving each other a help and cooperation.
We have achieved our objectives to learn the Thonny Python software, to codes
and to get familiarized with the Raspberry Pi’s components and each of its functions. I’m
still amazed knowing that the Raspberry Pi has a small size but it has the capability to run
like a personal computer.