G

Guest

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

Hello all
I am developing a PHP-based core to include:
- Dewdney's unused PCT instruction.
- Addressing of more components e.g. adding 1 to an opcode could transform
DAT into MOV.
- Persistent core - fragments of dead warrior programs remain and are
present at the next battle.
- Bitwise shifting and logic
- SPL scheduler implemented as a binary tree instead of (I'm assuming) a
linked list.. SPL branches a node into 2 threads. Execution always starts
from the top and alternates between left and right for a given root node.
Root nodes store the next direction to be traversed and leaf nodes are
Current Instruction Registers. This way, time is not shared equally - if two
SPLs are called, the three resulting threads will share the time in the
ratio 0.5 : 0.25 : 0.25 = 2:1:1.
- Website keeps database of instructions, users related to their warriors
and scores, and the core.

....and I am looking for any extra ideas or suggestions! About anything such
as instruction set, implementation, running a 'hill' etc.
At the moment the instruction set has 23 items, and the modifiers to address
components are A, B, opcode, and the modifier itself.
Addressing modes are currently just immediate, direct, and indirect. I am
undecided on predecrement and postincrement. I've seen some spurious-looking
symbols in that area, including the dollar sign.

Any ideas, suggestions, or notes on addressing are appreciated
Thanks in advance

Davard
 
G

Guest

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

On 2004-06-08, Davard <davaard@hotmail.com> wrote:
> - SPL scheduler implemented as a binary tree instead of (I'm assuming) a
> linked list.. SPL branches a node into 2 threads. Execution always starts

Actually, the usual implementation uses a circular array, although a
linked list could indeed be used for the same purpose.

> from the top and alternates between left and right for a given root node.
> Root nodes store the next direction to be traversed and leaf nodes are
> Current Instruction Registers. This way, time is not shared equally - if two
> SPLs are called, the three resulting threads will share the time in the
> ratio 0.5 : 0.25 : 0.25 = 2:1:1.

Note that you don't actually need to store the traversal direction in
the nodes; just use the binary expansion of the current turn number
(starting at 0) to decide which way to go at each branch (and stop
when you meet a leaf node).

For example, on turn 18 (binary 10010) you'd first go left (0), then
right (1), then twice left (0) and once right (1). On the next turn
(19, binary 10011) use the same sequence, but start by going right
instead.

You could even implement this with a fixed-length array, but then the
array size needs to be proportional to the maximum number of cycles in
a battle.

--
Ilmari Karonen
If replying by e-mail, please replace ".invalid" with ".net" in address.