PencilWars is based on a paper-and-pencil game of the same name detailed in Tom Angleberger's Oragami Yoda. It is built using the pygame 1.9 package and runs in either Python 2.7 or 3.4. You can download the source code here.
|Screen shot of pencilWars. Player 2 just moved indicated by the red pencil stroke and it's now Player 1's turn.|
The users take turns. If one hits an asteroid, they lose a turn. If one hits the space station in the middle of the page, they lose their ship. The first to destroy their opponent's ships wins.
One of the more interesting things I had to figure out was a function to determine the distance between the location of an sprite (ship, asteroid, station) and a line segment (the path taken by another ship). If the distance is less than sum of the two sprites' radii, there was a collision.
I hope you enjoy playing.