def busy_mail_room_test(): t = HRMAsm(['inbox', 'outbox', 'jump'], 0) t.program.append(HRMInstruct('inbox')) t.program.append(HRMInstruct('outbox')) jump = HRMInstruct('jump') jump.ref_value = 0 t.program.append(jump) busy_mail_room_eval(t) print t.fitness
def copy_floor_test(): t = HRMAsm(['inbox', 'outbox', 'jump', 'copyfrom'], 6) cp = HRMInstruct('copyfrom') cp.ref_value = 1 t.program.append(cp) t.program.append(HRMInstruct('outbox')) cp = HRMInstruct('copyfrom') cp.ref_value = 0 t.program.append(cp) t.program.append(HRMInstruct('outbox')) t.program.append(HRMInstruct('inbox')) t.program.append(HRMInstruct('outbox')) cp = HRMInstruct('jump') cp.ref_value = 7 t.program.append(cp) cp = HRMInstruct('copyfrom') cp.ref_value = 4 t.program.append(cp) floor_set = ['U', 'B', 'A', 'G', 'K', 'Z'] copy_floor_eval(t, floor_set) print t.fitness