Code Monkey home page Code Monkey logo

tabuada's Introduction

This project is a little toy in genetic programming. Basically we built a system that uses genetic programming to synthesize code into a tiny virtual machine.

To play you need of:

  • gcc

Building

In the src directory, execute the command: $ make

Testing

Run without changes, the gp program try synthesize a program that does the multiplication of two integers. Note that the virtual machine has no instruction of multiplication. Use this command for see the program in action:

$./gp -n 20 -t 50000000 -i 10 -H 30

Instructions of Virtual Machine

instructionnote
MOVE x yput the value of y in x
MOVI x numput the value num in x
ADD x yadds the value of y at x
SUBI x numdecreases the value num at x
JUMPZ x pcif x value is zero, jump to instruction in position pc
JUMP pcjump to instruction in position pc
RETstop the program

Examples of output

MOVE 2 0
SUBI 1 1
JUMPZ 1 8
ADD 2 0
JUMP 1
MOVE 0 1
JUMPZ 2 1
MOVE 0 2
RET

Another example (very strange/good):

MOVE  2 0
ADD   1 1
MOVE  2 0
JUMPZ 2 5
SUBI  1 2
JUMPZ 1 9
SUBI  1 2
ADD   0 2
JUMP  5
SUBI  1 3
SUBI  2 12
JUMPZ 0 3
MOVE  2 0
RET

Author

Trumae <[email protected]>

tabuada's People

Contributors

trumae avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

clflush

tabuada's Issues

License ?

Hello, under what license is this project released under ? I would like to learn from it. Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.