|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--physis.core.virtualmachine.SoupGeneticCodeTape
All organisms share one large memory pool. This allows many interactions between them. (Tierra-like)
| Field Summary | |
protected int |
allocated_size
|
protected boolean |
alreadyallocated
|
protected static byte[] |
attributes
The attributes array for the memory pool. |
protected int |
child_loc
The child's position. |
protected int |
child_size
The child's size |
private static InstructionSet |
instruction_set
|
protected int |
loc
The location of this codetape in the big pool. |
protected static short[] |
pool
This is the big memory pool. |
protected int |
size
The size of the codetape. |
| Fields inherited from interface physis.core.virtualmachine.GeneticCodeTape |
COPIED, EXECUTED, EXECUTED_OR_COPIED, MUTATED |
| Constructor Summary | |
(package private) |
SoupGeneticCodeTape(int loc_,
int size_)
|
|
SoupGeneticCodeTape(java.lang.String filename)
It reads the instructions from a file.The first organism is created this way.(One instruction per line, lines beginning with # are discarded. |
| Method Summary | |
void |
allocate(int numberof_newcells)
It's a biological operator. |
boolean |
blockCopy(int source,
int destination,
int length)
Copies an instruction from source position to destination position. |
int |
calculateEffectiveLength()
The effective length can be calculated by the number of executed instructions. |
void |
clearExecutedFlag(int position)
|
boolean |
contains(short instcode)
Returns true if the codetape contains the specified instruction. |
boolean |
copy(int source,
int destination)
Copies an instruction from source position to destination position. |
void |
delete()
Removes an instruction from a random position. |
GeneticCodeTape |
divide()
It divides the codetape. |
short |
fetchInst(int position)
Simply returns the instruction or operand on the specified position. |
Genome |
getChildGenome()
Returns the genetic information from the codetape. |
protected short |
getChildInstruction(int position)
|
Genome |
getGenome()
Returns the genetic information from the codetape. |
int |
getSize()
Returns the absolute size of the codetape.(number of contained instructions) |
void |
insert()
Inserts an instruction on a random position. |
boolean |
isAllocated()
Returns true if the cell already allocated space for the spawn. |
boolean |
isAllocationPossible(int numberof_newcells)
The size must be in a predefined range, otherwise the allocation fails. |
boolean |
isCopied(int position)
Answers the question: is the positionth instruction copied? |
boolean |
isExecuted(int position)
Answers the question: is the positionth instruction executed? |
boolean |
isMutated(int position)
Answers the question: is the positionth instruction mutated? |
boolean |
isProliferationPossible()
Checks whether the organism is able to spawn (are there enough copied instructions?). |
void |
mutate(int position)
Mutate the specified instruction. |
short |
read(int position)
It gives the instruction on the specified position. |
int |
searchBackward(int start,
short code,
int depth)
|
int |
searchForward(int start,
short code,
int depth)
|
void |
write(int position,
short new_value)
Sets the content of the tape on the specified position. |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
private static InstructionSet instruction_set
protected static short[] pool
protected static byte[] attributes
protected int loc
protected int size
protected int allocated_size
protected boolean alreadyallocated
protected int child_loc
protected int child_size
| Constructor Detail |
public SoupGeneticCodeTape(java.lang.String filename)
SoupGeneticCodeTape(int loc_,
int size_)
| Method Detail |
public short read(int position)
read in interface CodeTapepublic short fetchInst(int position)
GeneticCodeTaperead and write. The virtualmachine has to take care of the proper position.
It provides only quick access for the executable part of the code.fetchInst in interface GeneticCodeTape
public void write(int position,
short new_value)
CodeTapewrite in interface CodeTapepublic void clearExecutedFlag(int position)
clearExecutedFlag in interface GeneticCodeTapepublic boolean isAllocationPossible(int numberof_newcells)
GeneticCodeTapeisAllocationPossible in interface GeneticCodeTapepublic void allocate(int numberof_newcells)
GeneticCodeTapeallocate in interface GeneticCodeTapepublic boolean isAllocated()
GeneticCodeTapeisAllocated in interface GeneticCodeTapepublic boolean isProliferationPossible()
GeneticCodeTapeisProliferationPossible in interface GeneticCodeTapepublic GeneticCodeTape divide()
GeneticCodeTapeEnvironment is responsible for palcing the child,
the codetape only returns an other one.divide in interface GeneticCodeTapepublic void mutate(int position)
GeneticCodeTapemutate in interface GeneticCodeTapepublic boolean isMutated(int position)
GeneticCodeTapeisMutated in interface GeneticCodeTapepublic boolean isCopied(int position)
GeneticCodeTapeisCopied in interface GeneticCodeTapepublic boolean isExecuted(int position)
GeneticCodeTapeisExecuted in interface GeneticCodeTape
public boolean copy(int source,
int destination)
GeneticCodeTapecopy in interface GeneticCodeTape
public boolean blockCopy(int source,
int destination,
int length)
GeneticCodeTapeblockCopy in interface GeneticCodeTapepublic void insert()
insert in interface GeneticCodeTapepublic void delete()
delete in interface GeneticCodeTapepublic int getSize()
GeneticCodeTapegetSize in interface GeneticCodeTapepublic boolean contains(short instcode)
GeneticCodeTapecontains in interface GeneticCodeTapephysis.core.virtualmachine.GeneticCodeTapeinstcode - The searched instruction.
public int searchForward(int start,
short code,
int depth)
public int searchBackward(int start,
short code,
int depth)
public int calculateEffectiveLength()
calculateEffectiveLength in interface GeneticCodeTapepublic Genome getGenome()
getGenome in interface GeneticCodeTapepublic Genome getChildGenome()
getChildGenome in interface GeneticCodeTapeprotected short getChildInstruction(int position)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||