Anyway, my goal at the conference was to attend some sessions that improved my C# understanding and also to attend some sessions that would expand my overall programming experience.
I was most impressed by the F# and Python presentations. I went to 3 seperate sessions on Python. One of them was presented by Catherine Devlin and showed how to use Visual with Python to do some planetary simulations very easily.
It looked so easy to do some pretty incredible things, so I decided to try it out for myself. Here is what I came up with.
I made a Rubik's Cube Simulation and a Magnetic Disc simulation.
I was able to make the Rubik's Cube into an executable using py2exe. It ended up being 40 files in all (YIKES). I then made that exe into a Windows screen saver by changing the extension to .SCR and copying all 40 files into the Windows\System32 sub directory. It's pretty neat, but kinda messy to have to copy so many files.
Here is the source:
PyCube.py
MagDisc.py I added them to http://doug.mair.googlepages.com/
Descriptions of the programs:
Program 1: PyCube.py - Rubiks cube simulation.
Program 2: MagDisc.py - Simulation of Magnets which are fixed on a rotating disc.215 lines in all!! Amazing. It works, but it probably isn't
very python-like. I know there has to be better Python ways to do some of what I did in this program.Keys: Q - Toggles Demo Mode. F - Toggles flying the camera around.
Click on the edges of the face pieces to make them rotate.
I'm studying the interactions and forces between the discs. The forces between magnets are shown as gold cylinders shooting out of the front of the magnets.
I think my force equations are correct, but I'm having trouble converting the force between the magnets into the angular momentum of the disc. The discs also have a friction equation built into them,
so they should slow down and stop. They seem to work except when they are at their closest point. At which point the large disc spins out of control.You can drag and drop the disc to move them around. Also left/right clicking on a disc increases it's speed clockwise or counter-clockwise. It's only 150 lines so far. WOW.
No comments:
Post a Comment