A virtual “arena” in which programs will fight against one another (the “Champions”).
Corewar is a very peculiar game. It’s about bringing “players” together around a
“virtual machine”, which will load some “champions” who will fight against one another with the support of “processes”, with the objective being for these champions
to stay “alive”.
The processes are executed sequentially within the same virtual machine and memory space. They can therefore, among other things, write and rewrite on top of
each others so to corrupt one another, force the others to execute instructions that
can damage them.
The game ends when all the processes are dead. The winner is the last player
reported to be “alive”
-This is a project I made for Codam(42 Network). -This was a group project (Three people).
make
make re
make clean
make fclean
Your virtual machine will execute a machine code (or “bytecode”) that will be generated by your assembler. The assembler (the program) will get a file written in assembly language as argument and generate a champion that will be understood by the virtual machine.
In this reposatory the .s files can be found in the Champs folder. The assembler will create a .cor file that can be found in the same folder.
- Usage:
./asm [Champion .s file]
Inside the Vm, the champions are charged within the memory so that they can space out evenly
their entry points. The virtual machine will create a memory space dedicated to the combat of the
players, it will then load each champion and their associated processes and execute
them sequentially until they die.
The VM can take between 1 and 4 players. You can use a player more then once.
- Usage:
./corewar_vm [Champion .cor file]
-v: Use this flag to visualize the battle.
-dump:Aat the end of nbr_cycles of executions, the flaf willdump the memory on the standard output
and quit the game.
-n: sets the number of the next player. If non-existent, the player will have the next
available number in the order of the parameters. The last player will have the first
process in the order of execution.