TimeCoreWar is a programming game inspired from Core War. In this game, you’re going to create some programs that will fight each others in a shared memory. The implicit goal is to change the code of the code of others warriors while they still execute it. To increase the fun, you can also travel through time. ☺

This game is a free software and can be found there. You can also visit the forum or the corresponding page in the author’s website. Do not hesitate to contact me if you want to be part of the project!


Introduction

Similarly to Core War, your “creature”’s code will be put in a shared memory, where everyone will be able to read and write: you’ll thus be able to change the code of other players while playing! The memory is a tore: there is no beginning nor end. All instructions thus refers to other cells using relative addressing. For instance Goto 2 makes you jump to the cell being at relative position 2 from the current instruction: it thus miss one instruction to jump to the one after the next one. To simplify the creation of warriors, you can declare labels (by using any reasonable name followed by a colon) and use them instead of numbers. Some special labels already exists: you can use for instance Goto previous to jump to the previous instruction. Each instruction takes exactly one unit of time to be executed.

The instructions are detailed below, but one of them is interesting: Data. This instruction stores an integer on which you can perform computations (such as multiplication, addition, etc.); it is thus not an executable instruction and trying to execute it will kill your warrior (at least the thread that tried this unallowed operation). But what is interesting about this operation is that you can use it as an address. For instance while the instruction Goto 1 will jump to the next instruction, but Goto @1 will read the next cell (which must be a Data instruction), extract the number stored by the Data—for instance 42—then execute the instruction as if this number was written in the first Goto instruction—that is Goto 42. Do not hesitate to read the (commented) codes of the examples presented below or to read the ReadMe file to get more informations.

If you have any trouble with the time travelling, I advise you to read this article of David Madore or this mail of the same author. The model of TimeCoreWar is the one of a polychronic universe with a maximum following politic, in both ways. This following politic is not advsided by David Madore, but I’m not sure knowing why: if anyone’s got an answer, I’m interested! Note that in such a model, travelling to the past will (may I say “did”?) create a new thread. Travelling through time needs energy (one unit of energy for each unit of time travelled), paid at the sooner points of the travel path. Each warrior get one unit of energy every two units of time.

There follows a description of each instruction of TimeCoreWar.

Data a
Contains a number a.
Add a, b, c
Reads two datas cells a and b and write the sum of their stored numbers on the cell c.
Mult a, b, c
Reads two datas cells a and b and write the product of their stored numbers on the cell c.
Mod a, b, c
Reads two datas cells a and b and write the modulo of their stored numbers on the cell c.
Div a, b, c
Reads two datas cells a and b and write the quotient of their stored numbers on the cell c.
Cp a, b
Copies the cell a in the cell b.
Goto a
Jumps to the cell a.
If a, b, c
Checks if the data stored in cell a is null. If it is, it jumps to b, otherwise to c.
IfDat a, b, c
Checks if the cell a is of type Data. If it is, it jumps to b, otherwise to c.
JmpIfEqu a, b, c
Checks if the cell a is equal to the cell b. If it is, it jumps to c, otherwise to the next instruction.
JmpIfSameType a, b, c
Checks if the cell a has the same type than the cell b. If it is, it jumps to c, otherwise to the next instruction.
JmpIfNotEqu a, b, c
Checks if the cell a is equal to the cell b. If it isn’t, it jumps to c, otherwise to the next instruction.
JmpIfGreater a, b, c
Checks if data stored in the cell a is greater than the one stored in the cell b. If it is, it jumps to c, otherwise to the next instruction.
Function a
Like Data, this instruction is not executable.
Call a, b
The cell pointed by a have to be a Function c instruction. It copies the content of cell b to the cell c, the position of this last one being computed relatively from the cell a and not from the current pointer. It then jumps to the instruction following a.
Back a
Travel through time by the unit of time stored in cell a (see above for precision about time travelling).
Cpt a, b, c
Copy the content of the cell a to the cell b at the time stored in the cell c. It uses the same energy than going back (or forward) to this time.
Rand a
It puts a random Data in the cell a.
CountThreads a, b
It puts in the cell a the number of thread currently executed at position b.
GiveEnergy a
It gives the energy stored in the cell a to the last warrior that writes this last cell. If this amount of energy is negative, it just looses this amount. In practise, this instruction is more intended to be executed by your opponents.

If you have some time, I would appreciate a lot some feedbacks of this project, thanks!


Play TimeCoreWar!

TimeCoreWar is an OCaml program and should thus be downloaded to be executed normally. However since Ocsigen exists, it is possible to compile OCaml to JavaScript: it is thus possible to try TimeCoreWar directly in your browser! Of course, it will be slower than the executed program: I strongly advice you to download the program once you’ll be used with the set of instructions.

Please contact me if you have any problem with this program, or if you want to share a warrior ☺.

You can import warriors from your disk, or you can use some example warriors:

You can also import some of my own warriors: Good game!