Welcome to the CoreWars Evolver home page.

Copyright © 2005-2013, Miha Vitorovic

All the GA related options and instructions are part of the version 0.5 and currently not available, unless you checkout the source and build the application yourself. But even then some things still don't work.

Index

1. Introduction

The goal of this project is to develop a Java Genetic Algorithm redcode warrior evolver. This document provides some basic information and is split into two parts. It starts with the user part, followed by a developer part.

2. User information

2.1. Instructions

To run CoreWars you will need Java 6. You may download it from www.java.com. After you install Java, you may start CoreWars with:

java -jar <JAR archive name> [options] warriorFile [warriorFile warriorFile ...]

Options:
-e     (--debug) Opens debug window, allows single-stepping, and memory inspection.
-r #     (--rounds) Specify the number of rounds.
-s #     (--size) Specify core size.
-c #     (--max-cycles) Sets the maximum number of cycles per round.
-p #     (--max-processes) Sets the maximum number of processes a warrior can run. The default is 8000.
-l #     (--length) Sets the maximum length of a warrior source file in instructions. It defaults to 100 and can be up to 500.
-d #     (--min-distance) Specify minimal distance between warriors.
-S #     (--p-space-size) Specify P-space size.
-F #     (--fixed-address) Install second warrior at fixed address #.
-b     (--brief) This options runs pMARS in brief output mode. It suppresses warrior listings after assembly.
-= $     (--score-formula) Define a score formula. Default: (W*W-1)/S
GA options:
-GC $     (--generate-config) Generates config XML file with a given name.
-RC $     (--run-config) Runs the GA algorithm using the config file.

2.2. Documentation

Mars interpreter (I hope) finally works correctly, or at least it runs the "validate.red" warrior (part of pMARS distribution) the way it should. The interpreter is based on ICWS 94 Proposed Standard implementation.

It supports all ICWS'94 OpCodes including P-space, and so far the following meta instructions:

Arithmetic:
+     addition or unary plus
-     subtraction or unary minus
*     multiplication
/     division
%     modulo (remainder of division)
Comparison:
==     equality
!=     inequality
<     less than
>     greater than
<=     less than or equal
>=     greater than or equal
Logical:
&&     and
||     or
!     not
Assignment (will be added later)
=     assignment
Comparison and logical operators return 1 for true and 0 for false. Parentheses can be used to override this precedence order:
1) ! - + (unary)
2) * / %
3) - + (binary)
4) == != < > <= >=
5) &&
6) ||
7) =

Supports EQU and FOR/ROF loops. The goal was to compile everything pMARS does, and even some things that pMARS doesn't. The compiled output may not be character by character the same as with pMARs, but is functionally equivalent, e.q. you may get '7983' instead of '-17', for CORESIZE 8000.

2.2.1. Genetic algorithm

Please note, that fitness function should evaluate to floating point number.

For GA fitness function the following operators may be used:

Arithmetic:
+     addition or unary plus
-     subtraction or unary minus
*     multiplication
/     division
%     modulo (remainder of division)
Comparison:
==     equality
!=     inequality
<     less than
>     greater than
<=     less than or equal
>=     greater than or equal
Logical:
&&     and
||     or
!     not
Comparison and logical operators return 1 for true and 0 for false. Parentheses can be used to override this precedence order:
1) ! - + (unary)
2) * / %
3) - + (binary)
4) == != < > <= >=
5) &&
6) ||

Variables are the statistics collected during the warrior execution, and can be used to calculate a fitness function. This section lists variables and gives some examples on how to used them

Valid XHTML 1.0 Strict