I’m please to announce a new release of Kojo (Version 030512-1).
This release contains an exciting new feature that allows you to interactively manipulate your program to produce interesting output. The feature is really simple to use. Basically, you Ctrl+Click on any number in your program; that brings up a window which allows you to change the number. As you change the number, you get to see the corresponding (changing) program output.
Let’s see this in action.Here’s a slightly modified version of the Tree sample in Kojo:
def tree(distance: Double) { if (distance > 4) { val ang = 25 val adel = 20 setPenThickness(distance/7) setPenColor(color(distance.toInt, math.abs(255-distance*3).toInt, 125)) forward(distance) right(ang) tree(distance*0.8-2) left(ang + adel) tree(distance-10) right(adel) back(distance) } } clear() invisible() setAnimationDelay(0) penUp() back(200) penDown() tree(90)
Run it to get the following figure in the Drawing Canvas
Now, Ctrl+Click the number 25 in line number 3 of the program above. That should bring up the IPM window.
Now, just move the slider around using the arrow keys or mouse clicks. For each click, you should see a different shape in the Drawing Canvas. As you play along, you’ll encounter a series of shapes that look something like this:
Starting to see how this feature works?
Here’s another program to play with:
clear() invisible() setAnimationDelay(0) setPenColor(Color(0, 136, 204)) repeat(43) { forward(200) right(242) }
And here’s some IPM output for this program:
The IPM (Interactive Program Moulding/Manipulation) feature in Kojo is inspired in part by Bret Victor’s Inventing on Principle talk. This release contains just a small beginning in the direction of IPM. Expect future releases of Kojo to build upon this in interesting ways.
Many thanks to Jerzy Redlarski for pointing me to Bret Victor’s talk in the first place, and to Björn Regnell for providing constructive feedback during the implementation of the feature.
Also included in this release is an important fix. For the past few versions of Kojo (ever since the upgrade to the Netbeans 7.1.1 Platform), using the Window -> Reset Windows menu item makes the Script Editor unusable. This release fixes that problem. So this is a recommended upgrade.
As always, the new version is available from the Kojo Download Page.
Enjoy!
Pingback: New Kojo Release – A Minor IPM Upgrade « The Kojo Learning Environment
Pingback: New Kojo Release (150512) – With performance improvements for Picture drawing « The Kojo Learning Environment
Pingback: New Kojo Release (Version 250512) « The Kojo Learning Environment