Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: Battle script

by Ovid (Cardinal)
on Jun 06, 2002 at 15:57 UTC ( #172263=note: print w/replies, xml ) Need Help??

in reply to Battle script

That reminds me of an article I had read some time ago. I can't recall where, but I'll summarize it and if anyone wants to work with it. This was a long time ago, so my memory is probably wrong about some aspects.

Essentially, the article was about a computer program that allows you to use two programs to fight. You have a series of addresses (the arena) where the last address connects to the first (like a circle) and each program "lives" in the arena. There was a very basic assembler-like language that controlled what each could do. Commands were fairly straightforward and the language was, IIRC, turing-complete. The goal of each program was to disable the other.

For example, one of the most successful programs, the "imp gun", was four lines long (and addresses, the way the languages worked):

  1. Assign a value to a variable representing an address (this value was the first address after the end of the program - I don't remember how initialization worked)
  2. Move a null command to that address
  3. Add 4 to that address
  4. Goto 2

With a program that small, it was awfully tough to disable (by moving a bad instruction to it). It simply laid down a string of null commands and if any of them hit the opponent, the opponent would be disabled. Some programs would try to find the other program (maybe a binary search of an imp-gun trail, for example), others would lay decoys and move themselves, etc. This could be a fun project :)


Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.

Replies are listed 'Best First'.
Re: Re: Battle script
by Chmrr (Vicar) on Jun 06, 2002 at 18:36 UTC

    I believe you're referring to core wars. Take a gander at for more information.

    perl -pe '"I lo*`+$^X$\"$]!$/"=~m%(.*)%s;$_=$1;y^`+*^e v^#$&V"+@( NO CARRIER'

Re^2: Battle script
by Aristotle (Chancellor) on Jun 06, 2002 at 19:56 UTC
    That would indeed be Corewar. Sadly, my skills at writing warriors for that never grew beyond mediocre - but I wrote some Perl tools for it anyway. :-)

    Makeshifts last the longest.
Re: Re: Battle script
by Dog and Pony (Priest) on Jun 06, 2002 at 19:25 UTC
    If I recall correctly, this is part of where the knowledge and skills for writing virus programs came from - the programmers became very skilled in concealing their programs, modifying other pieces of code, etc.

    Really too bad that some of them decided to use their knowledge that way. Not to say that all (or even most) virus writers had that kind of background, or that playing that game was a bad thing - it really sounds like tremendous fun. :)

    You have moved into a dark place.
    It is pitch black. You are likely to be eaten by a grue.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://172263]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2021-08-04 06:42 GMT
Find Nodes?
    Voting Booth?
    My primary motivation for participating at PerlMonks is: (Choices in context)

    Results (41 votes). Check out past polls.