## Processing, Pong, and Kinetic Theory

I’ve been playing around with using Processing as a way to quickly get my Calculus students doing some programming. One of my experiments was in using what I’ve learned over the past couple months about object oriented programming to make the game have multiple balls in play at once.

Once I saw how well this worked, it turned rapidly into an attempt to max out my processor. The balls have random initial locations, and ‘speeds’ distributed uniformly between -2 and 2 pixels/frame.

The pong program keeps track of the bounces off of the left and right walls, and uses this as a basic way to calculate a score. When I saw this, it looked just like a kinetic theory simulation for ideal gases, though the particles are only bouncing off of the walls, not each other. That bounce variable keeps track of the collisions with the walls – can anything cool that can be calculated just from the picture alone and the number of collisions?

Processing sketch can be found here.