Allegro.cc - Online Community

Allegro.cc Forums » Game Design & Concepts » Mutating Programs

This thread is locked; no one can reply to it. rss feed Print
Mutating Programs
Billybob
Member #3,136
January 2003

WOAH, I just remembered something, I made an Emulator of the Shadow I proccessor. heh, anywho, just this topic brought that up.

BTW, If the Shadow I proccessor doesn't seem like a familiar name, it shouldn't be, it was an imaginary proccessor used in the imaginary Classic Fantasy system I was going to emulate. WEIRD huh? Sorry, I was on drugs when I came up with that idea.

Kanzure
Member #3,669
July 2003
avatar

Post IRC channel. Log everything. My computer is tooooo sloooowww...

Carrus85
Member #2,633
August 2002
avatar

#Progranisms on EFNet if anyone wants to join

Billybob
Member #3,136
January 2003

arg, I knew I should have learned what irc was. NEVER FEAR, I shall search the web.

dang this music blows

Carrus85
Member #2,633
August 2002
avatar

Download Mozilla. It has a built in IRC client.

Billybob
Member #3,136
January 2003

runs around ahhhh, slow download....mha

Kanzure
Member #3,669
July 2003
avatar

must...join! I'm downloadin' hold ur horses...

uhh..done o_O damn that was fast

{EDIT}
Connecting is SLOW! Sigh..

Billybob
Member #3,136
January 2003

slow for me...

Kanzure
Member #3,669
July 2003
avatar

Can't connect error.

Set the IRC network as "All" (Wtf?) and lets just go to #Progranisms :P

CGamesPlay
Member #2,559
July 2002
avatar

Join EFNet, like, irc.choopa.net or irc.prison.net then join #progranisms

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

Carrus85
Member #2,633
August 2002
avatar

You have to set your network to EFNET then you can join #progranisms. Just try multiple times... Sometimes the servers are annoying, and with the east coast power down, it could be quite a feat to get online...

Billybob
Member #3,136
January 2003

I wasn't able to connect to EFNet the first time, went the second time though

Kanzure
Member #3,669
July 2003
avatar

Meh, I got in.......3rd time is the charm.

damage
Member #3,438
April 2003

William said:

3. As it reads through its own file and outputs to one of the copies, it has a 10% chance of making a mistake(mutation), either adding, removing, or changing a byte of machine code. There is also a 1% chance of 2 mistakes.

Sorry, but I don't understand how you could get this to work. If you randomly change machine code it is highly likely that you will create code that causes
- segment violation exceptions
- unknown opcode exceptions
- other weird errors

Secondly, you need a tonne of generations to get anything useful evolved. 1 generation/minute probably won't give you enough generations.

____
Don't have anything private. Don't do anything silly like having a hidden name and address field with get_name and set_address and get_name and set_name functions. - Bjarne Stroustrop, creator of C++

Billybob
Member #3,136
January 2003

That's the point, the ones that fail die >8) Win XP wont crash, at least it hasn't yet. And trust me, these progranisms make THOUSANDS of mutations and they evolved

Kanzure
Member #3,669
July 2003
avatar

But we need something that won't crash.

X-G
Member #856
December 2000
avatar

That's now Darwinian evolution works. Some times something changes; most often it's bad, some times it's not. The bad mutations die, the good ones survive to make copies of themselves.

Same thing here. You just have to be lucky and run LOTS of copies.

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

Carrus85
Member #2,633
August 2002
avatar

What we need to do is just find a way to prevent those crashes from halting the system completely... If we could do that, it would be one killer application of computers...

Unfortunately, my short progranism code doesn't work, gives me MSVCRT.DLL errors. GDB gives me SIGSEV errors as well...

Well, here is my code. Pretty short, but it should do the job...

1#include <stdio.h>
2#include <string.h>
3#include <stdlib.h>
4 
5#define FILENAMEROOT "pros"
6#define RATE_OF_MUTATION 10000
7#define SLEEPTIME 60000
8#define FILENUMB 1001
9 
10int main (int argc, char *argv[]) {
11 FILE *fp, *fcopy, *fin;
12
13 unsigned long seedcalc=0;
14 int index=0;
15
16 char filename[80], c;
17
18 while (argv[0][index]!='\0') {
19 seedcalc+=(int)argv[0][index];
20 index++;
21 }
22
23 srand(seedcalc);
24 sleep(SLEEPTIME);
25
26 for (index=0;index<2;index++) {
27 if (fin = fopen(argv[0], "rb")) {
28 fclose(fp);
29 }
30
31 sprintf(filename, FILENAMEROOT"%d.exe", rand()%FILENUMB);
32
33 if (fp = fopen(filename, "wb")) {
34 fclose(fp);
35 }
36
37 while (1) {
38 c = fgetc( fin );
39
40 if (rand()%RATE_OF_MUTATION) {
41 c = rand()%256;
42 }
43
44 if (!feof(fin)) {
45 fputc( c, fp );
46 }
47
48 else
49 break;
50 }
51
52 fclose(fin);
53 fclose(fp);
54
55 sprintf(filename, "start %s", filename);
56 system(filename);
57 }
58 return 0;
59}

Compiles down to 24.96 kb, FYI. If we can get this to work, it should take up a minimum of resources...

And please, don't kick me for using something not completely supported by C (It compiles with GCC... Should be pretty much valid C), I'm more of a C++ person anyway.

FYI: It locks up when trying to perform a binary read open on the source file...

CGamesPlay
Member #2,559
July 2002
avatar

            if (rand()%RATE_OF_MUTATION) {
                c = rand()%256;
            }

That mutates every 9999 out of 10000, btw...

        if (fp = fopen(filename, "wb")) {
            fclose(fp);
        }

What? If the file fails to open properly the close it? huh?

And what happened to the VM?

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

Fladimir da Gorf
Member #1,565
October 2001
avatar

What I'd do is to have some "silent sectors" in the code, which aren't in use right now. And a lot of jump calls and labels everywhere, so if one of those jump calls gets mutated, and jumps to the "silent code", strange things would happen.

OpenLayer has reached a random SVN version number ;) | Online manual | Installation video!| MSVC projects now possible with cmake | Now alvailable as a Dev-C++ Devpack! (Thanks to Kotori)

X-G
Member #856
December 2000
avatar

Junk DNA?

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

aybabtu
Member #2,891
November 2002

Wow....this is sooooo cool! William, you've made up for all your programming/off-topic forum errors!! I'm definatly gonna mess with this stuff!

spellcaster
Member #1,493
September 2001
avatar

Sorry... but you guys are absolutley crazy.
First of all: His program is buggy even w/o some random chanes.
Secondly, if you change your program randomly, it's not very hard to wipe out your hd.
Or randomly altering files you don't intend to alter.

If you guys want to do something like this, use VM ware google for "genetic algorithms" and/or "artificial life".

That's why better than playing russian roulette with your computer.

When I read his post I though, ok, I'll shut up and won't flame him. In fact I thought Korval or 23 would do that for me.
Next day the thread had around 90 very positive replies... either youo guys are trying to force him to do even more stupid things and I just didn't get it... or... well.... don't know.

Geez.
If you want to ruin your puter, you should at least make sure the exe header stays intact. That way the exe will be executed, that gives your experiment a better chance to fry your system.

Have fun.

--
There are no stupid questions, but there are a lot of inquisitive idiots.

X-G
Member #856
December 2000
avatar

I think I remember saying quite early that this should be done inside a VM - it's the idea that's cool, not the way he's doing it. ::)

http://www.gamleby.net/x-g/guru.gif

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

Kanzure
Member #3,669
July 2003
avatar

We agreed for a VM ;)

- Meh I'm out of the project. In the IRC room they were talking about an ENTIRE operating system for this thing.



Go to: