teaching machines

First-person Math

October 4, 2013 by . Filed under madeup, public.

Nothing brings together the remote reaches of computer science together like writing your own programming language. My abstract syntax tree exploits inheritance and polymorphism and multiple inheritance. My parsing is done in Java while the model of the program is built up of C++ classes. I’ve got tables, stacks, and vectors. Recursion is naturally all over the place. The problem domain is 3-D graphics, and I’m writing an application for mobile devices. Some days it’s overwhelming.

My prototype of the language was accepted for presentation at Microsoft’s ProMoTo 2013 workshop, part of Splash. I’m working to get a set of good examples showing the educational power that I think Madeup offers. For instance, I thought making this was going to be easy:

An M drawn in my Madeup language.

When writing the code, however, I failed many times. I didn’t get the bending right until I sat down with paper and figured out the complementary and supplementary angles. The M was like a wild bronco—I had to climb up, speak soothing words, and bring it home. The M was like a warhead shooting through space—I dropped onto it and steered it to safety and peace. The M was like a firehose rearing up under the pressure of the water—I had to lasso it down to the ground and direct it it to good end. This is first-person math.

In other news, Madeup now supports comments. I aimed for a character that’s easier to find on mobile keyboards. Here’s the code I used to make the M:

-- Make the tube pretty narrow with a
-- hexagonal cross section.
radius = 0.5
nsides = 6

-- Break the line up for me so
-- that joints aren't so sharp.
fracture = 0.1

-- Start at the origin heading up.
moveto 0 0 0

-- Draw the left upright leg.
move 10

-- Turn sharply to the right to
-- draw the left slanty leg.
yaw 160
move 10

-- Turn sharply back to the left.
-- Draw the right slanty leg
yaw -140
move 10

-- Turn sharply back to the right
-- to point down. Draw the right
-- upright leg.
yaw 160
move 10

tube