G
Guest
Guest
Archived from groups: rec.games.corewar (More info?)
I'm a complete newbie to CoreWar, and I'm having difficulty figuring out how to
accomplish various things in redcode. My current dilemma is how to perform
comparison tests on values. The only way I can think of explaining what I'm
mulling over is to give an example of what I'm trying thus far...
;------------------------------------------------------------------------------
; Setting up the initial values...
v1 : nop 0
v2 : nop 0
v3 : nop 0
init: mov #2 , v1
mov v1 , v2
mov #25 , v3
; Okay, here's the area I'm having trouble with. In this test, I'm *trying* to
; loop until the B-field of v1 holds the square root of 25. I've tried to do
; this by calculating its square (B-field of v2) and then comparing it to the
; B-field of v3 (which, of course, holds my target value). Apparently, I don't
; understand how to set up a >= comparison for the field values in question.
test: mul v1 , v2
jmn stop , (v2 >= v3) ; Attempting the comparison here. It doesn't
; want to work this way.
incr: add #1 , v1
mov v1 , v2
jmp test
stop: dat 0
;------------------------------------------------------------------------------
Hopefully, I've been able to phrase my question so it's understandable. Would
someone be kind enough to lend me their expertise?
TIA,
- BootSector
(No email ATM, so the MadHatter addy is just a dummy value to keep my newsreader
from whining.)
I'm a complete newbie to CoreWar, and I'm having difficulty figuring out how to
accomplish various things in redcode. My current dilemma is how to perform
comparison tests on values. The only way I can think of explaining what I'm
mulling over is to give an example of what I'm trying thus far...
;------------------------------------------------------------------------------
; Setting up the initial values...
v1 : nop 0
v2 : nop 0
v3 : nop 0
init: mov #2 , v1
mov v1 , v2
mov #25 , v3
; Okay, here's the area I'm having trouble with. In this test, I'm *trying* to
; loop until the B-field of v1 holds the square root of 25. I've tried to do
; this by calculating its square (B-field of v2) and then comparing it to the
; B-field of v3 (which, of course, holds my target value). Apparently, I don't
; understand how to set up a >= comparison for the field values in question.
test: mul v1 , v2
jmn stop , (v2 >= v3) ; Attempting the comparison here. It doesn't
; want to work this way.
incr: add #1 , v1
mov v1 , v2
jmp test
stop: dat 0
;------------------------------------------------------------------------------
Hopefully, I've been able to phrase my question so it's understandable. Would
someone be kind enough to lend me their expertise?
TIA,
- BootSector
(No email ATM, so the MadHatter addy is just a dummy value to keep my newsreader
from whining.)