And Now Comes the Source code of the project
1
W.B.W. Commented Sources
Those are the commented sources of the W.B.W project discussed by Marcus Minkowski and Faust Amoyo in the first and fourth chapters of the Romanian section of the novel.
According to the novel, the whole project was written by Marcus Minkowski to illustrate evolution. He read Dawkins’ ‘The Blind Watchmaker’ and became obsessed with the biomorphs. Later, Marcus decided to make an even more powerful illustration of evolution by watching a living creature evolve. And what can that living creature be but the only life form that humans created? A computer Virus!
Marcus later Decided that he should remove the viral code and replace it with a benign program that replicates in its own-created files, thus he could openly take credit for the program. An extra bonus for that move turned out to be a faster, safer and easier testing.
The Project consists of two files. The first one is a COM file, called GEN.COM. This COM file is written in assembly. It generates files from AA.COM to ZZ.COM. These files resemble the mother file almost completely. Yet they carry certain mutations. Mutations can be either extra bytes, deleted bytes or altered bytes.
The Second file is a program written in Basic. It is called SELECT.BAS. It can be executed via Qbasic or turned into an EXE file with QuickBasic. It will scan all the generated files, from AA.COM to ZZ.COM, for a certain sequence of bytes and will eliminate each and every copy where that code is present. This program is supposed to emulate the antivirus software and may represent a predator or a parasite. Yet it is not the only selective force involved. Marcus would also try to execute all the copies that survived the scanner massacre and test them for smooth execution. Most of the mutants were, as he did expect, nonfunctional and would usually result in system crash. Marcus also deleted all those copies. Yet, he was not troubled at all by their presence for they emulated the defected offspring that were spontaneously aborted.
Watching The Blind Watchmaker
===
How it works:
1- Make a new folder. Put in it the file GEN.COM and the file SELECT.EXE (or SELECT.BAS and Qbasic if you didn’t compile it).
2- Run GEN.COM, you will see files created from AA.COM to ZZ.COM
3- Run SELECT.EXE, you will see that most of the files will be eliminated.
4- Manually test the few remaining files for proper execution. Copy each into another empty folder, rename it to GEN.COM and execute it. Delete all the files that fail to reproduce or crash the system.
5- If you are left with a file that still works and replicates giving functional offspring, then the program did indeed evolve. That’s what happened with me, and with Marcus in the novel. I believe that this confirms microevolution. Yet can you force this program to evolve encryption? This is the Minkowski challenge. He failed and gave up, saying that the microevolution he watched happen was enough. I also didn’t end up with any encrypted version of this file in my numerous trials. For theoretical discussion of the consequences of this program please read the discussion in the fourth chapter of the Romanian section of the novel.
; Watching The Blind Watchmaker
; ===
; First: The Replicator (GEN.ASM)
;
; Copyright © 2006 by Fady Bahig
; This program was written by Fady Bahig in 2006
; for the novel ‘The Journey Of The Fool’
; The W.B.W project was supposed to be written
; in the fiction by Marcus Minkowski
; This is the replicator part of the project
; Upon executing this COM file it will generate
; Mutated Copies of itself from AA.com till ZZ.com
; Mutants can be missing bytes, with an extra bytes
; or with altered bytes.
; To compile put in GEN.ASM then compile with A86
; GEN.COM will be then produced.
Code_begins:
jmp Code_start
Message: db "Now creating "
Filename: db "AA.COM",0 ;File name of the first file
db 13,10, "$"
Code_start:
push cs
push cs
pop ds
pop es
; BUG! Marcus should have put some NOPs here to avoid the
; jump in a smaller mutant from going to the above instructions.
Make_next_file:;This loop generates files
nop ;Those nops are necessary here because if a byte is
nop ;added the backwards jump location will be
nop ;corrupted. So I decided to put them for safety.
nop
; The following 4 instructions are the search string.
; For any copy to avoid being detected and deleted,
; the following 12 bytes must be altered somehow
; to avoid detection.
lea di,offset Code_ends;Make a copy at the heap
mov si,offset Code_begins;A copy of myself
mov cx,(Code_ends-Code_begins);My size
copy_loop:
call Get_random_number;Will I mutate this byte?
cmp al,1h
je Mutate;Yes?
Movsb;No
cont_replicate:
loop copy_loop;Copy all the bytes
jmp continue
Mutate:
call Get_random_number;What is the type of the ;mutation?
cmp al,10h
jb add_byte;Will we add a byte?
cmp al,20h
jb sub_byte;Will we remove a byte?
call Get_random_number ;Will we change a byte
inc si
stosb
jmp cont_replicate
sub_byte:;We will remove a byte
inc si
jmp cont_replicate
add_byte:;We will add a byte
movsb
call Get_random_number
stosb
jmp cont_replicate
continue:
mov dx,offset Filename;Create a file
mov ah,03ch;with new name.
xor cx,cx;Copy all the data,
int 21h;And close.
xchg bx,ax
mov ah,040h
mov dx,offset Code_ends
mov cx,offset (Code_ends-Code_begins)
int 21h
mov ah,03eh
int 21h
mov ah,09h;Print message to say
mov dx, offset message;that the file is created
int 21h;successfully
cmp word ptr [Filename],"ZZ";Did we reach ZZ.COM?
jne stillmake;No? Make another file
int 20h
stillmake:
inc byte ptr [Filename+1];Calculate the
cmp byte ptr [Filename+1],"Z"+1;name of next file
jne skip_fix
mov byte ptr [Filename+1],"A"
inc byte ptr [Filename]
skip_fix:
jmp Make_next_file;Generate the next file
Get_random_number:;Get a random number
in al,40h;This procedure is
xchg al,ah;Used to make mutations
in al,40h;And see if we will make one.
xor al,ah
add al,ah
ror al,1
xor ax,bx
add ax,cx
sub ax,dx
xor al,ah
ret
db 10h dup (0) ; A reserve buffer so that if a mutant is longer
Code_ends: ; by a byte or two, it will still be copied
;GEN.ASM ends here
' Watching The Blind Watchmaker
' ===
' Second: The Selector.
' This program was written by Fady Bahig in 2006
' for the novel ‘The Journey Of The Fool’
' The W.B.W project was supposed to be written
' in the fiction by Marcus Minkowski
' This is the selector part of the project
' Upon executing this program it will scan for all the
' the generated COM files from AA.COM to ZZ.COM
' and will erase each and every copy carrying the search string:
' That is a certain sequence of bytes.
' This program can be run with Qbasic or can be
' turned into an EXE file by QB. In case you desire to
' turn it into an EXE, you must alter the first few lines. See
' comments for details
' To run with Qbasic put in SELECT.BAS and then open it
' with Qbasic and then choose start from run
DIM A AS INTEGER
'stext$ = COMMAND$
' activate if making EXE then run select.exe with the sequence of bytes as a parameter
' i.e. : Select BFB801BE0001B9B800E86500
stext$ = "BFB801BE0001B9B800E86500"
'Deactivate if EXE
IF stext$ = "/?" OR stext$ = "?" OR stext$ = "" THEN
PRINT "W.B.W Selector"
PRINT "Deletes all the ??.COM files"
PRINT "carring the byte sequence"
PRINT "enterd as a parameter."
PRINT ""
PRINT "And ..."
PRINT "Marcus Minkowski says to you all"
PRINT "VIVA ROMANIA

"
END
END IF
FOR l1 = 65 TO 90 ' Scan file names from AA to ZZ
FOR l2 = 65 TO 90
file$ = CHR$(l1) + CHR$(l2) + ".COM"
OPEN file$ FOR BINARY AS #1
b = -1 ' Make a text string of all the bytes
text$ = ""'In the file
DO UNTIL EOF(1)
b = b + 2
GET #1, b, A
b$ = HEX$(A)
IF LEN(b$) < 4 THEN b$ = STRING$(4 - LEN(b$), "0") + b$
b$ = RIGHT$(b$, 2) + LEFT$(b$, 2)
text$ = text$ + b$
LOOP
CLOSE
' If the byte sequence is present in the file, eliminate it and
' inform the user
IF INSTR(text$, stext$) <> 0 THEN
KILL file$
PRINT file$ + " was eliminated."
END IF
NEXT l2
NEXT l1
END
' SELECT.BAS ends here.