royvanrijn: You can use "Twitterific for iPhone", another app from iTunes. A newer version, but not as good as the previous.

Corewars – Brainf*ck

December 2nd, 2009

I’ve implemented a Brainfuck interpreter!

Yes, you heard it right, Brainfuck (BF).
BF is an esoteric programming language. More information on BF can be found here.

The language itself is pretty simple, and most of it was implemented rather quickly in Redcode. The only big problem was navigating back to the correct closing brackets in a loop. This is now solved by counting the amount of open/close brackets in between.

So here is the code:

Continue reading »

Corewars – SUBLEQ interpreter

December 2nd, 2009

In my previous blogpost I talked about Corewars and the Redcode language. But instead of playing the game, you can do a lot more with the programming language. John Metcalf posted a blog about OISC (One Instruction Set Computers). He decided to implement the RSSB algorithm, so I took on the challenge of implementing SUBLEQ, another single instruction set computer.

And here is the result:

Continue reading »

Corewars – An Introduction to Hostile Programming

December 1st, 2009

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 celebrates it’s 25th anniversary in 2009. If you’d like to discover more about Corewar, here are the top resources:

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