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.
Pages