/polyCode

AI driven programming language, compiling images to code and code to images

Primary LanguageJava

polyCode

AI driven programming language, compiling images to code and code to images.

Draw a simple polygon to test; polyCode enforces symmetries in the image, while preserving it's initial structure, employing them for the usage of loops during compilation. Compiled functions are displayed in the terminal, in the form objectN(posX, posY, rotDeg), where N stands for the object's ID. All such functions may be called on.

Objects drawn by the moving poly, are compiled in the same manner after detachment by trail-less movement, or change of location (setLoc(posX, posY) call).

###The mathematics

polyCode employs the author's ongoing research on dynamic relational nets in it’s most basic form, where the pullback-space on one-forms and the vertex-space both contain only one element, namely the linear function and the identity operator. This model allows simple modeling of embedded graphs.

By defining appropriate equivalence relations, the set of all isomorphisms is constructed, generating all isomorphic objects under said relations. Thus, constraints may be enforced upon these objects, while preserving their initial structure, as mapped by the isomorphisms.

The interpretation of shape as a distribution is used as a metric of similarity between such objects, allowing further classification within isomorphisms through convergence of characteristic functions.

It employs javaCalculus library developed by the author.

####Built-in commands:

penDown() -> movement leaves a trail

penUp() -> movement is trail-less

move(length) -> translates by length in current direction

rotate(degrees) -> rotates

rename(oldName, newName) -> renames a compiled function

setLoc(posX, posY) -> sets location

setRot(degree) -> sets rotation by degrees

setRot(vecX,vecY) -> sets rotation by direction vector

setColor(color) -> sets drawing color

resetColor() -> resets to default color

setColorVertex(color) -> sets color of vertices

printAll() -> prints all compiled functions

clear() -> clears the terminal

###How to run

Hosted on gitHub is a pre-prepared eclipse project ready to be imported. Classes are sorted in appropriate pacages for conveniant editing and running.

Hosted on dropbox is a runnable .jar file.

###Demos

demoImageToCode2 demoImageToCode demoCodeToImage

Creative Commons License
polyCode by Žiga Sajovic is licensed under a Creative Commons Attribution 4.0 International License.