Tuesday, 21 October 2008

Roy's Modification to Mini Challenge #7

Roy suggested an interesting modification to Neo's Mini Challenge #7 in rec.games.corewar. Create an imp capable of passing through the following code:
djn.f #0, >-5
The aim is to tie as often as possible.  Lines of code and the number of processes should be kept to a minimum.
  • Newbies should aim for >95% ties in 7 lines or less.
  • Intermediate redcoders should be able to discover a solution with 100% ties in 5 lines.
  • Corewar pros should aim for a solution with 100% ties in 4 lines or less!

Friday, 17 October 2008

Mini Challenge #7 - "Harmless Overrun"

Neo has proposed a mini challenge in which players have to create an imp capable of passing through a wimp with imp-gate.  Both warriors must survive the encounter.
jmp 0, <-5 
For more details, see the mini challenge homepage.

Saturday, 11 October 2008

More Semaphores in Redcode

While not as elegant as the solution found by Neo and Roy, the following has the advantage of only requiring one DAT.

semaphore: dat    1
reset: mul.ab semaphore, semaphore
wait: djn reset, semaphore
mov.a #0, semaphore
signal: mov #1, }sema

The second technique kills waiting processes, then respawns them when signaled.

semaphore: dat    1
kill: dat 0
wait: djn kill, semaphore
signal: mov.a #1, semaphore
add.x semaphore, semaphore
seq.a #1, semaphore
spl next