Electromagnetism Game -- Scientific Programming

Cooper student Chris Hong wrote a game in Python that allows the user to manipulate an electric charge into a box using electric and magnetic fields that are under the user's control. The video clip below shows a bit of gameplay. The game is very difficult to master!

The "universe" for the game is the larger (outer) cube.On the outer faces of this cube are large circles, which represent current-carrying coils that produce magnetic fields, and small (filled-in) circles, which represent electric charges that produce electric fields. If any of these objects is "greyed out" then it is currently turned off. If any of these objects is green, then it is turned on.The user can turn any or all of these objects on and off to produce fields that will act on an electric charge that is inside the outer cube.The goal is to manipulate the charge into the smaller cube -- which is only open on one of its six faces (the colored face).At any time, the user can also change his or her 3D orientation in space, so as to get a better view of the motion.

Turning on the electric charges has a relatively simple effect on the charge that the user is trying to control. The movable charge is simply repelled.But turning on the magnetic coils has a much more complicated effect on the movable charge, since the coils produce a magnetic field that is very complicated in shape, and the force on the movable charge at any instant is perpendicular to both that magnetic field and the current velocity of the movable charge.