Giter Club home page Giter Club logo

corewar's Introduction

Summary:

In this project, you will create a virtual “arena” in which programs will fight against one another (the “Champions”). You will also create an assembler to compile those Champions as well as a Champion to show the world that you can create life from coffee.

Introduction:

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”.

General Considerations:

  • The last project of Codam (42 Network School) in the ai branch, the full PDF can be found in this repository.
  • Group project (three people).
  • Makefile commands:
make
make re
make clean
make fclean

Assembler:

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 [ champs/file.s ]

The Virtual Machine:

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 [ champs/file.cor champs/file.cor ]

Flags:

-v : Use this flag to visualize the battle.
-dump : At 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.

Controls to the visualizer:

Space to stop and continue the process.
S to go to the next movement.

Images:

alt text

corewar's People

Contributors

isadorarebelo avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.