Article 1914 of rec.games.corewar: Path: hellgate.utah.edu!dog.ee.lbl.gov!overload.lbl.gov!agate!howland.reston.ans.net!usc!elroy.jpl.nasa.gov!kilroy!jlayland From: jlayland@kilroy.Jpl.Nasa.Gov (James Layland) Newsgroups: rec.games.corewar Subject: A Kinder, Gentler Core Warrior Date: 25 Jun 1993 23:33:56 GMT Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 38 Message-ID: <20g214\$d2q@elroy.jpl.nasa.gov> NNTP-Posting-Host: kilroy.jpl.nasa.gov I think that with so much violence in movies, TV, video games, etc. it is shameful to have this newsgroup dominated by bloodthirsty programs whose sole purpose is to kill each other. In the interests of spawning a kinder, gentler, more productive corewar, I have here a small redcode program which calculates the greatest common divisor of two numbers, showing that our language need not be used solely for warlike purposes. Perhaps we could get funding from the Clinton administration for the Core War Defense Conversion Program, promoting dual use technologies in corewar-- imagine a bomber which finds new primes by bombing with small prime numbers (sieve of Eratosthenes). I see a whole new arena of corewar programming here. Of course, to do meaningful mathematics, we may need to increase the core size to, say, 10^50 or so. But this is just an implementation issue. ;name GCD ;finds the Greatest common divisor of a and b tmp dat #0 a dat #17*151 b dat #23*151 start jmz quit, b ; while (b>0) { loop sub b, a ; for (; a>=b; a-=b); slt a, b jmp loop mov a, tmp ; swap(a,b); mov b, a mov tmp, b jmp start ; } quit ; we're done-- now a=151=gcd(17*151,23*151), b=0 ; insert replicating cmp-scanning imp spiral vampire here James jlayland@grissom.jpl.nasa.gov