Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Self-replicating, self-modifying Assembly program that can evolve into every possible computer program in the universe (EXPERIMENTAL)

License

NotificationsYou must be signed in to change notification settings

mertyildiran/ldca

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Self-replicating, self-modifying Assembly program that can evolve into every possible computer program in the universe.

LDCA

NASM is required to compile the Assembly program.

Compiling & Running

CAUTION: Since this program executes random CPU instructions, it might run potentialy harmful machine code of any kind. For example: You can accidentally delete a file from your disk or change some configuration in your system. Although it's statistically insignificant, you should still run it in an isolated environment. Also read the NOTICE below.

NOTICE: Program execution (that executes random CPU instructions) is disabled temporarily. To re-enable it, remove; before thecall program occurences inldca.asm file.

Go into the directory that matches your operating system and CPU architecture combination. For example:cd linux_x86

Run:make

The binary should be ready onouts/0000000000000000000000000000000000000000000000000

Go into theouts/ directory and run it:

cd outs/./0000000000000000000000000000000000000000000000000cd ..

Now you should be seeing these three binaries:

$ ls outs/000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000002

that means it's replicated and created 2 offsprings.

Now you can run these commands sequentially to achieve the results shown in the animation at the top:

clearmake cleanmakemake stracemake diff

or simply run:

./dev.sh

Development

For development purposes, it's better to run the program for a brief amount of time like this:

clearmake cleanmaketimeout 0.2 make stracemake diff

so that it will only generate a few hundred programs.

Where are the descendants?

The descendants are in the same directory that you run the initial program0000000000000000000000000000000000000000000000000.Don't try to runls to see the list of files if you run the program for a few minutes. Usels --sort=none instead.

How do I remove these generated programs?

Do not try to runrm * inside theouts/ becauserm cannot handle that amount files.Go into parent directorycd .. and userm -f outs/ instead.

Why is it called Last Digital Common Ancestor?

Because it's the digital version ofLast Universal Common Ancestor.If you look at it from a philosophical point of view, LDCA is actually a descendant of LUCA.

Algorithm

The Assembly program first executes the subroutine namedprogram which is the section that actually evolves.Then the program replicates itself. While replicating, with 50% probability one of the random mutations, that arelisted below, happens:

  • with 80% probability replace a randomly chosen byte in theprogram section with a random byte.
  • with 5% probability shrink theprogram section randomly by a factor of 1 byte toprogram section's size.
  • with 15% probability grow theprogram section randomly by a factor of 1 byte to 256 bytes and fill it with random bytes.

Replication creates a new binary using system calls by copying the memory region which the program's itself loaded into.Then executes the newly created binary by forking using system calls. Replication happens two times for each successfulprogram execution. So the number of processes increases exponentially.

Programs that created after a random mutation might fail to reach toreplicate subroutine. Such programs cannotproduce its offsprings.

To be able to fully understand the algorithm you should go through the lines ofldca.asmAssembly code and read the comments.

Constants

There are some constants that hard-coded into the Assembly program which are open to optimization:

  • Filename length:49
  • Body of the subroutine namedprogram
  • 50% evolution rate:rndNum 0, 1
  • Grow size: Between 1 byte and 256 bytes (rndNum 1, 256)
  • 80% random byte mutation chance:cmp eax, 80
  • 5% shrink mutation chance:cmp eax, 85
  • 15% grow mutation chance:100 - 85

License

Last Digital Common Ancestor is licensed under theGNU General Public License v3.0.

About

Self-replicating, self-modifying Assembly program that can evolve into every possible computer program in the universe (EXPERIMENTAL)

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp