This project was the last part of Hive Helsinki (School 42) core studies (old curriculum) for our team:
André Backman, Matias Jokela, Pyry-Peetri Piironen and Teppo Pölönen.
Corewar is the implementation of a 1984-created programming game Core war.
In Core war, two or more battle programs (called "warriors") compete for control of a virtual computer. These battle programs are written in an abstract assembly language called Redcode. The standards for the language and the virtual machine were initially set by the International Core Wars Society (ICWS), but later standards were determined by community consensus.
The project has three mandatory parts:
- The Assembler
- The Virtual Machine
- The Champion
The full assignment PDF.
Coming soon . . . .
The VM executable is called corewar and it will be compiled by running make.
The VM allocates a memory area called the arena, places the champions in the arena, and executes the gameplay.
Before the game, the VM will introduce the contestants and after the game, it declares the winner.
./corewar <flags> <champ_1.cor> <champ_2.cor> <...>
| Flag | Description |
|---|---|
-a <N> |
Show cycles and operations. Dump memory after N cycles. |
-b |
Execute lld statement with the same bug as the original Corewar. Also, make aff statement invisible. Using this flag makes the program replicate the original Core war in all cases. |
-c <N> |
Dump data from carriages after N cycles. |
-d <N> |
Dump memory in the same form as the original Corewar after N cycles. |
-dump <N> |
Dump memory on the form asked on the pdf after N cycles. |
-n <N> |
Set the number of the next player. |
The last part of the project was to write our own champion. The point was pretty much just to do a valid champion and we ended up creating HansMoleman no more than 15 minutes.
Click here to see code.
.name "Hans"
.comment "Go Springfield!"
st r1, 2050
live %0
fork %999
live %0
fork %999
live %0
fork %999
live %0
fork %999
live %0
fork %999
live %0
fork %999
live %0
fork %999
live %0
fork %999
live %0
fork %999
live %0
fork %999
live %0
fork %999
live %0
fork %999
live %0
fork %999
live %0
fork %999
