Optimizing methods

G

Guest

Guest
Archived from groups: rec.games.corewar (More info?)

People, I believe, have programs that allow them to brute-force test
random constants in their warriors. I need one. Anyone willing to
share one with me?

I just need something that can generate and automatically test
warriors with random constants.
 
Archived from groups: rec.games.corewar (More info?)

On 19 May 2004 16:29:30 -0700, Andrew Hunter wrote:

> People, I believe, have programs that allow them to brute-force test
> random constants in their warriors. I need one. Anyone willing to
> share one with me?

I don't think you want to see mine. 🙂

File create.c

#include <stdio.h>

int main()
{
int h,i,j,k;
FILE *fp;

srand(time(NULL));
i=rand(800)%800;
j=rand(800)%800;
i*=10; j*=10;
printf("iX = %d\n",i);
printf("sX = %d\n",j);
fp = fopen("header.red","w");
fprintf(fp,";redcode-94nop\n;name si\n;author Lukasz Grabun\n");
fprintf(fp,";assert CORESIZE==8000\niX\tequ\t%d\n",i);
fprintf(fp,"sX\tequ\t%d\n",j);
fclose(fp);
}

File tourney.sh

#!/bin/bash
create
cat header.red source.red > pap.red
koth pap.red 250 stoneimp

Repeat three last lines ~500 times. 🙂

That's example header.red

;redcode-94nop
;name si
;author Lukasz Grabun
;assert CORESIZE==8000
iX equ 30
sX equ 7300

--
Lukasz Grabun (My CW page: http://www.dwarfscorner.com/)
(reply-to field is fake, use grabek (at) acn dot waw dot pl to reply)