Mutated computer program

41 posts / 0 new
Last post
Nyarlathotep's picture
Mutated computer program

Valiya, remember when you told me that all that [I] have to do is show [you] an example of a computer which took on new functions by adding bits?

So I got bored at work and wrote a little program. This program (let's call it program A) takes a different program (program B) and alters it randomly by replace 1 letter with a random letter. It then tries to run program B, and spits out interesting results. I ran it 2000 times (that is it started with the original code and mutated it once, then tried to run it, rinse repeat 2000 times).

The unmodified program B is:
def f(x,y):
print x+y
f(3,7)
Or simply, print the sum of 3 and 7.

After 'mutation':

About 90% of the time, program B crashes (which program A is protected against), so nothing is returned.

About 5% of the time, program B runs, but fails to print anything.

About 2% of the time program B runs as expected. Often times this is because a character was inserted that does nothing, like an extra space in many locations won't produce a noticeable difference in the output of function B.

About 2% of the time, one of the numbers being input in to Program B got altered (like maybe the 3 got changed to an 8).

About 1% of the time, program B runs but outputs something very unexpected. I expected to see certain mutations, and I actually saw very few of those. But I did see several very weird one. Below is a list of the ones I thought were interesting. It displays the new mutated version of the function, the output it gave, the mutation number when this occurred, and my description of the mutation.

--------------------
def f(x,y):
print x-y
f(3,7)
output = -4
mutation number: 59
Notes: Turned the addition function into a subtraction function. This is one of the few I actually anticipated.
--------------------
def f(x,y):
print -+y
f(3,7)
output = -7
mutation number: 252
Notes: This one returns the negative of y. Similar mutation in 1923.
--------------------
def f(x,y):
print 8+y
f(3,7)
output = 15
mutation number: 315
Notes: This one changed to a function that just returns y + 8, similar mutation occurred in 382, 384, 491, 11, 15, 1004, 1161, 1283, 1328, 1502, 1538, 1583, 1591, 1698, 1938.
--------------------
def z(x,y):
print x+y
f(3,7)
output = False
mutation number: 828
Note: This one renamed the function to z (instead of f), so when it tried to call it, it used the wrong name which returns the output: False
--------------------
def f(x,y):
print x%y
f(3,7)
output = 3
mutation number: 936
Notes: This mutation changes the function from calculating the sum of the 1st and 2nd number, to calculating their modulo.
--------------------
def f(x,y):
print x

Subscription Note: 

Choosing to subscribe to this topic will automatically register you for email notifications for comments and updates on this thread.

Email notifications will be sent out daily by default unless specified otherwise on your account which you can edit by going to your userpage here and clicking on the subscriptions tab.

ThePragmatic's picture
Nice work. An extremly
Nyarlathotep's picture
LOL! Yeah, I want to do more
Rohan M.'s picture
You know, the way you said
Nyarlathotep's picture
Yeah, I tried to make it
Nyarlathotep's picture
Valiya - "From what i can
Valiya's picture
Hi Nyarl
Nyarlathotep's picture
I'll tell you how the
Valiya's picture
Please don't think I am being
Nyarlathotep's picture
Yes, that part of the program
Valiya's picture
this is what i found in line
Valiya's picture
this is what i found in line
Nyarlathotep's picture
that is the correct line of
Spewer's picture
"I'm not going to explain the
Nyarlathotep's picture
yes exactly... The length of
Valiya's picture
how does the computer
Nyarlathotep's picture
the method of generating
Valiya's picture
Nyarl... i am trying to
Nyarlathotep's picture
I just told you, simply
Valiya's picture
is the last (digit, time etc)
Nyarlathotep's picture
the last digit from the heat
Valiya's picture
Look i am not complaining...
Nyarlathotep's picture
Ok sure. Meanwhile I've been
CyberLN's picture
Partitioning the hard drive
Nyarlathotep's picture
that is one of the things I
mysticrose's picture
That is really interesting. I
mdeepm's picture
Very interesting and a good
ThePragmatic's picture
It is a really interesting
Kreston's picture
Friends. I absolutely agree
salimakhan888's picture
Indeed, very good that this
carlmarx's picture
That's all the fantasies of

Pages

Donating = Loving

Heart Icon

Bringing you atheist articles and building active godless communities takes hundreds of hours and resources each month. If you find any joy or stimulation at Atheist Republic, please consider becoming a Supporting Member with a recurring monthly donation of your choosing, between a cup of tea and a good dinner.

Or make a one-time donation in any amount.