Now, Neogryzor did make some nice redcode challenges some time ago,
however he hasnt had recently much time to work with redcode, so it is
probably time for me to take over them.
These puzzles here are not time-limited nor intentional competitions,
but rather i would be interested in seeing some actual problems solved
in redcode. Submitting them to me is not compulsory, but i will publish,
or atleast try to benchmark solutions sent to me.
Lets presume we have an array of X numbers. The goal would be
to divide the array into two, so that the sum of numbers inside both individual
arrays would be equal, or as equal as possible. The size of the new arrays
does not matter, as long as the sum of numbers is equal.
Example: 12 7 9 5 4 11 8 5 3 2 would be sorted:
12 8 7 4 2 (=33) and 11 9 5 5 3 (=33)
or 12 7 9 5 (=33) and 4 11 8 5 3 2 (=33)
How would you implement this in redcode? Multiple correct solutions will be
possible on large number-arrays, and any of them will count.
For sake of uniformity, lets presume the following settings:
- Coresize 8000
- Lines 0-100 are reserved for the calculator
- Lines 200-400 are reserved for the data, but the dataset may be smaller than that.
- Dataset will contain no zeroes, so it signifies end of data.
- Results are stored in 500-700 and 800-1000
- Once program has finished, it will kill itself.
- The commandline when using pmars would be
"pmars -l 200 -d 200 -F 200 calcu.red data.red"
- The data is a dummy warrior, consisting of jmp $0, #number, and dat $0, #number's
- The numbers are stored in b-fields.
- The sum of all numbers in the data will be less than 4000 (coresize/2)
- When there is always an even solution, program can be quite a lot smaller,
than when only a near solution is possible. Thus the puzzle can be divided
into "medium" and "hard" -difficulties.
What is the smallest program capable of getting the correct result? What
would be the fastest?
Oh, and about returning results to me, my trashmail-addy is email@example.com ,
but those that know my main address can use it (since it is not spam-filtered, mails
wont get accidentally thrown in trash).