Hey guys, I'd like to introduce a project that I've been working on for a while. It's a programming language called Circa. It's a dataflow-based language, that features runtime code mutability and built-in learning/training. I think it has a lot of potential not just for AI, but for other things like procedural graphics.
Here's a really simple example of the built-in learning.
a = 0.0?
b = (a + 2) * 3
train(b, target = 9)
When the program reaches the train() call, it asks itself, how can I change stuff so that b is 9? So it goes backwards and changes stuff (only changing values that have a question mark). In this case it would instantly change 'a' to 1.0
Internally it accomplishes this by storing a dataflow view of the equations. There are 3 expression entities (internally called terms) in the above code; one for the 0.0, one for the addition, one for the multiplication. The train() call tells the multiplcation term that it should be 9. This feedback continues backwards through the code in a way that's pretty much the same as the Backpropagation algorithm.
For an example of how this functionality can be used in cool ways, I wrote the following demo code. Behold, the first working Circa program!
g = null # java graphics object (passed externally)
center_x = 80.0
# eyes
eye_y = 40.0?
eye_spread = 30.0?
function eye(x, y)
{
draggable(x,y)
circle(g, x, y, 10)
circle(g, x, y, 1)
}
eye(center_x - eye_spread, eye_y) # left eye
eye(center_x + eye_spread, eye_y) # right eye
# mouth
mouth_y = 100.0
mouth_v_scalar = 30.0?
mouth_width = 50.0?
mouth_steps = 10
start_lines()
for step in range(-mouth_steps,mouth_steps+1)
{
x = center_x + mouth_width * step / mouth_steps
y = mouth_y + mouth_v_scalar * sqr(step / mouth_steps)
draggable(x,y)
line_to(g, x, y)
}
This code draws a simple smiley face, with two bulging eyes and a parabolic mouth.
Here's what it looks like (a Java 1.5 applet)
The part that's cool is, you can drag around pieces of the face. The eyes can be moved around, and the smile can be stretched and inverted.
And nowhere did I have to tell the system exactly how things should be dragged. I didn't tell it, for example, that moving one eye should move the other eye symmetrically. All I did was write stragically-placed question marks, and made calls to draggable(). The rest is implied from the code.
Anyway, that's the concept. I'm planning to release the whole thing free and GPLed, but I don't think it's quite ready to be released yet. Right now it's at the proof-of-concept stage.
Feedback, ideas for other applications, or requests for ports to the language of your choice are welcome!