Article 2349 of rec.games.corewar:
Newsgroups: rec.games.corewar
Path: hellgate.utah.edu!dog.ee.lbl.gov!agate!library.ucla.edu!europa.eng.gtefsd.com!uunet!newsflash.concordia.ca!sifon!broue!bleumont
From: bleumont@rot.qc.ca (Bleumont)
Subject: Re: MNCT Round 2 Rules
Message-ID:
Organization: Groupe de Recherche Operationnelle en Telecommunication (ROT) Inc.
X-Newsreader: TIN [version 1.2 PL2]
References: <2c729v$fkg@agate.berkeley.edu> <2cp4c7$mhc@agate.berkeley.edu> <2dg5vu$jok@agate.berkeley.edu>
Date: Sat, 4 Dec 1993 02:31:04 GMT
Lines: 72
Michael Constant (mconst@soda.berkeley.edu) wrote:
[me ranting about not getting favor for round 2 :)]
: This is a type of problem that has occured quite a bit with round 2 submiss's
: That is, people ask for a slight bending of the rules (different input
: location, different output location, me not using certain input numbers (!),
: etc.) and I'm not sure whether to grant them these changes to the original
: rules. I'm afraid that if I do, then people with legitimate programs will
: feel cheated. But if I don't, then the people requesting these changes will
: have to do, in some cases, an awful lot of recoding. Any opinions?
At least, it more fair that way for all. And since the submission date has passed,
I can freely divulgate my original design, which needs to get the prime as a
negative number and works `only' for the 1-7950 range. Only 17 instructions
long with a best case around 300 cycles, worst around 70000 (for 89 * 89).
I had a version 1 instruction longer with a best case of 1 (with 1 as input).
Anyway, here is the original (my submission is slightly different):
de
;name Promotion
;author Pierre Baillargeon
;strategy
;strategy We start with the number, and substract the current prime-divisor
;strategy until the result is lower than the current prime divisor. While
;strategy doing it, mark the memory with #1 so we can generate the new prime-
;strategy divisors at the same time. This as the advantage of not having to
;strategy keep a table of divisors in the code (would use 24 locations) nor
;strategy having to compute them before-hand for nothing. But if number is
;strategy too large, we modify ourselves (oups !).
;strategy
;strategy The calculation loop is four instructions long, which i believe
;strategy would be hard to beat (but not impossible, would make program
;strategy longer though).
;strategy
;strategy If the result of the substract loop is zero, we have found a
;strategy divisor, so keep it and re-use it again.
;strategy
;strategy If the result is non-zero, scan the marked memory, beginning
;strategy at the current prime-divisor to find the new prime-divisor.
;strategy
keep equ bottom+20 ; where we keep the factors, if any
test equ top-1 ; pointer for numbers and prime markers
number equ bottom+2 ; we keep the number there
top
found sub div,= number
div_res jmp verify,#-6479 ; yes -> verify if exact multiple
djn mark,div_res ; no -> increase quotient and loop
verify sub number,test ; verify equality
jmz found,test ; yes -> found a factor !
mov div,test ; no, find new prime-divisor
search jmn search, keep searching
mov test,div ; keep new prime-divisor
djn n_found,#24 ; if more than 24 divisors, number is prime
sub number,