Last article showed how we could use Processing with Eclipse and Java 1.5. Heady with success, I decided to try to convert the near-trivial RandBoxes Processing demo to Jython.
Why?? Well, our group uses Blender quite a bit, and Blender uses Python as its scripting language. More generally, Python is quite popular within our scientific community.
Jython, a Python implementation using the JVM, has been surprisingly successful, having most of what we like about CPython. And its Java integration made it a natural for Processing. This presentation is a good overview.
read more..
We at Redfish have been using Processing.org’s graphics system for models requiring fairly sophisticated 3D capabilities. Here’s an example prototype of the Pittsburgh PNC Baseball Stadium done with Processing. (Note: Our Redfish site has more information on the project page.
Processing is more than a graphics library, it has a delightful IDE which makes Java much easier, especially for the Java novice. The IDE has great tools such as a web-page builder with the project as an applet. It also can build an application version for Mac, Windows and Linux.
One difficulty we faced however, was that we wanted to commit to fairly complicated models that would benefit from Java 1.5 (Processing uses an earlier version) and an IDE familiar to Java programmers. We also are interested in interfacing Java to other languages such as Groovy, Python/Jython, Ruby/JRuby, and even JavaScript/Rhino.
So I decided to experiment with Processing, using Eclipse and Java 1.5. To do this, I made two models: RandBoxes, which is really simple .. just showing 1000 boxes and randomly jiggling them each step. The second model, RoadGrid, is more complicated: it draws a rectangular road grid and has “cars” (rectangles) moving along the roads. At each intersection, the cars randomly chose a new road segment.
read more..
Last year, Nick Thompson, Professor of Psychology and Ethology of Clark University, dropped by Santa Fe on Sabbatical. Nick brought with him a puzzle relating to the Prisoner's Dilemma.
The core idea of the Prisoner's Dilemma is a game where two folks choose to cooperate or not (defect). The scoring is such that if you cooperate and your opponent defects, you (the "sucker") get quite a low score. If you both cooperate, however, you get a reasonable score but not as high as a defector gets against a cooperator. This classic in game theory poses the paradox that your best move is to defect, even though if you both defect, you both get a very poor score. Grim.
Robert Axelrod was puzzled by this, and suggested that if the game were repeated (iterated), the best outcome would could vary according to the strategy of the players. This resulted in his now famous computer tournament pairing strategies against one another. The sweet result was that a firm but friendly strategy, Tit for Tat, which cooperated initially, then simply repeated the opponent's previous move from then on, was the overall winner.
Nick, looking at this, thought that it'd be nuts to stay in a series of Prisoner's Dilemma games if the opponent was clearly no fun to work with. Thus he introduced the idea of leaving the tournament. MOTH, My way Or The Highway, builds a new suite of strategies which have the additional capability of leaving an unpleasant encounter. This creates a pool of strategies without partners, so they are re-paired randomly, and the tournament continues.
The result is that Nick, along with several of our local Friam group here in Santa Fe, worked on a NetLogo model exploring this new approach. This model expanded upon and validated earlier work done by Nick and his colleagues David Joyce and John Kennison. This resulted in a paper delivered to the Lake Arrowhead Conference on Human Complex Systems.
The NetLogo Model we created is viewable by you, gentle reader. The explanation provided with the model presents considerable detail about the ideas behind the Moth strategy.
Not surprisingly, a quite successful strategy is a variation of Tit for Tat: play Tit for Tat and on the first defection by your opponent, leave the tournament to be paired with a (hopefully!) more cooperative player!
I've got an initial version of a NetLogo model with cars cruising on a map of Santa Fe, NM. This was done as a proof of concept with summer students working in the RedfishGroup.
Their project included working with the Santa Fe police on understanding the dynamics of cruising around the plaza, a center of Santa Fe activities.
This model is somewhat unusual due to using tiny patches: 2×2 pixels each! Generally the patch size is considerably larger. The challenge was to use a GIS generated map of the downtown area, and to import this into NetLogo so that the patches gave a feel of a map image. This has been pushed to 1 pixel patches with no difficulty other than the time needed to import the image.
The jpg image was processed by converting it into the PPM image (portable pix map) text graphics format, then using the NetLogo rgb primitive to convert that image to a format NetLogo could use. It was then written back out to a data file consisting of only the NetLogo integer color values used by the model's patches.
The final hack was to literally cut & paste the data file into the NetLogo program file (.nlogo file) as an array! This avoided some Java security problems concerning file access that will go away with the current NetLogo beta. But it works so well, we may just keep it for a bit.
Being new to textpattern, I was delighted to see how easy it was to update from g1.19 to 1.0rc1. Deanload the bundle, unpack it, move the old .../textpattern to the side, replacing it with the deanload, and copy in my prior config.php file.
That's it! I keep a mirror of the site on my laptop, and both upgrades were that simple.
The new system has some sweet features such as separating the edit articles page from the articles themselves, making it easier to manage existing articles. Also can specify how many articles show on a page .. nice for modem users I suspect.