Skip to content

rm-hull/corewar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Core War Build Status

A clojure / clojurescript / core.async implementation of A. K. Dewdney's Core War

An introduction to hostile programming

Corewar is a game from the 1980's, played between computer programs written in Redcode, a language similar to assembly. The programmers design their battle programs to remove opponents from the memory of the MARS virtual computer by any means possible.

Some of the simpler techniques include blindly overwriting memory, searching for the opponent or spawning off new processes. These are commonly known as stone, scissors, paper after the popular playground game. Stone usually wins against scissors, scissors normally defeat paper, and paper mostly beats stone.

Here's an example of a typical Corewar program:

     org   wipe

     step  equ 5
     first equ bomb-10

bomb:mov.i #1,       -1

ptr: sub   #step,    #first
wipe:jmz.f ptr,      @ptr

     mov   bomb,     >ptr
     djn.f wipe,     {ptr-5

     end

This simple example of scissors once held a 20 point lead over it's rivals. The first instruction is never executed, it's the bomb used to overwrite opponents. The next two instructions form a loop which looks through memory for an opponent, and the final two instructions actually overwrite it.

Corewar is still going strong, and celebrated it's 25th anniversary in 2009. If you'd like to discover more about Corewar, here are the top resources:

#corewars is the official Corewar discussion channel, hosted by irc.freenode.net.

What are your experiences with Corewar, have you ever had any success?

Implementation details

Pre-requisites

You will need Leiningen 2.4.2 or above installed.

Building

To build and install the library locally, run:

$ lein test
$ lein cljsbuild once
$ lein install

Including in your project

There will be a version hosted at Clojars. For leiningen include a dependency:

[rm-hull/corewar "0.0.1-SNAPSHOT"]

For maven-based projects, add the following to your pom.xml:

<dependency>
  <groupId>rm-hull</groupId>
  <artifactId>corewar</artifactId>
  <version>0.0.1-SNAPSHOT</version>
</dependency>

TODO

Known Bugs

References

License

The MIT License (MIT)

Copyright (c) 2014 Richard Hull

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

A clojure / clojurescript / core.async implementation of A. K. Dewdney's Core War

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published