Skip to content
This repository has been archived by the owner on Nov 3, 2020. It is now read-only.
/ genetic-brainfck Public archive

A genetic algorithm for generating Brainf*ck programs in Haskell

Notifications You must be signed in to change notification settings

darkf/genetic-brainfck

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A genetic algorithm for generating Brainf*ck programs in Haskell, based on the algorithm from this article.

The interpreter has three stages:

  • String to intermediate representation (IR)
  • IR to an instruction set (ISC)
  • ISC to an output string

While converting IR to ISC, it also reduces instructions, going from, say, [Plus, Plus, Plus, Minus] to [Modify 2] (3 Pluses + 1 Minus = 2 overall). Loops (not implemented in the GA yet) are also parsed into a Loop [ISC] form for easy manipulation.

Usage

Compile main.hs with ghc main.hs -O3 -o ga.exe then run ga.exe if you desire. You may also interpret it (slowly) with runhaskell main.hs.

About

A genetic algorithm for generating Brainf*ck programs in Haskell

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published