Monday, 7 January 2008

Euclid's algorithm

Euclid's algorithm is used to determine the Greatest Common Divisor of two values. Despite it's simplicity, the only previous redcode implementation I can find is broken.

Implementation in Redcode:

          org    euclid+2

euclid mod.ab #a, #b
mov.x euclid, euclid
jmn.a euclid, euclid

0 comments: