public override void executa(IOrganismo o)
        {
            int inst = o.getMemory(o.ip + 1);

            inst = mundo.getMutation().mutateInstruction(inst, o);
            int regVal = o.getReg(getByteOrganismo(o, 2));

            o.setMemory(regVal, inst);
        }
Esempio n. 2
0
        private void randomizeInstruction(IOrganismo o)
        {
            int memPos = CRJavaUtils.randomInt(-10, 10);

            int index = o.ip() + memPos;
            int inst  = o.getMemory(index);

            inst = changeInstruction(inst);
            o.setMemory(index, inst);
        }
        public override void executa(IOrganismo o)
        {
            int fromPos = o.getReg(getByteOrganismo(o, 2));
            int inst    = o.getMemory(fromPos);

            inst = mundo.getMutation().mutateInstruction(inst, o);

            /*if (!mundo.isValidInstruction(inst)){
             *  o.fatalError();
             *  return;
             * }*/
            o.setReg(getByteOrganismo(o, 1), inst);
        }
Esempio n. 4
0
        private void randomizeInstruction(IOrganismo o)
        {
            int memPos = Utils.RandomInt(-10, 10);

            int index = o.ip + memPos;

            if (index < o.sp())
            {
                index = o.sp();
            }
            int inst = o.getMemory(index);

            inst = changeInstruction(inst);
            o.setMemory(index, inst);
        }
Esempio n. 5
0
 public override String getDescription(IOrganismo o, int ip)
 {
     return(comment(name + " " + ALifeConsts.getLetter(o.getMemory(ip + 1)), ALifeConsts.getLetter(o.getMemory(ip + 1)) + " <- pop()"));
 }
Esempio n. 6
0
 public override String getDescription(IOrganismo o, int ip)
 {
     return(comment(name + " " + ALifeConsts.getLetter(o.getMemory(ip + 1)) + "," + ALifeConsts.getLetter(o.getMemory(ip + 2)), "Allocate " + ALifeConsts.getLetter(o.getMemory(ip + 1)) + " Bytes; store position in " + ALifeConsts.getLetter(o.getMemory(ip + 2))));
 }
Esempio n. 7
0
 public override String getDescription(IOrganismo o, int ip)
 {
     return(comment(name + " " + ALifeConsts.getLetter(o.getMemory(ip + 1)) + "," + ALifeConsts.getLetter(o.getMemory(ip + 2)), "if " + ALifeConsts.getLetter(o.getMemory(ip + 1)) + " < " + ALifeConsts.getLetter(o.getMemory(ip + 2)) + " then:"));
 }
Esempio n. 8
0
        protected int getByteOrganismo(IOrganismo o, int pos)
        {
            int inst = o.getMemory(o.ip + pos);

            return(inst);
        }
Esempio n. 9
0
 public override String getDescription(IOrganismo o, int ip)
 {
     return(comment(name + " " + ALifeConsts.getLetter(o.getMemory(ip + 1)), "push(ip); ip <- " + o.getMemory(ip + 1) + ";"));
 }
Esempio n. 10
0
 public override String getDescription(IOrganismo o, int ip)
 {
     return(comment(name + " " + o.getMemory(ip + 1), "ip <- " + o.getMemory(ip + 1)));
 }
Esempio n. 11
0
 public override String getDescription(IOrganismo o, int ip)
 {
     return(comment(name + " " + ALifeConsts.getLetter(o.getMemory(ip + 1)), ALifeConsts.getLetter(o.getMemory(ip + 1)) + " <- templatePosition" + (this.bwd ? "  BACK " : "") + (this.fwd ? " FWD " : "")));
 }