Live data from Hacker News

Two Programs Enter, One Program Leaves

codinghorror.com

21–30 of 38 posts

Re: Two Programs Enter, One Program Leaves

#21
post #2

What happens if the instruction pointer for, say, process A, steps into the code space for another process, B? Does the simulator treat it as an illegal instruction causing A to lose? Or does process A continue, but executing B's code?

I think it treats it as a legal instruction. What I don't get is the replicator strategy. How does replicating yourself help not die? Even if you replicate yourself to all the memory except one address -- but that one address is where your IP is you're screwed. It seems like repairing yourself and attacking the opponent are the only feasible strategies -- at least if I understand correctly.

It does not treat it as an illegal instruction. It keeps running their code just fine. This is how Imps fight.

The most basic imp is defined as

   mov 0 1
It copies itself to one instruction ahead of itself. On the off chance it hits the opponents pointer, the opponent becomes an imp too and they both just circle around the core forever.

See elwin's comment below on vampires (for now, hopefully above soon).

Re: Two Programs Enter, One Program Leaves

#22
post #3

Microsoft did something similar to promote the .NET framework in it's early days. They launched the Terrarium competition http://terrarium2.codeplex.com/ where you would code your creature's AI in C# or Managed C++ and ship it as a DLL that would compete against other peoples creatures.

Woah. Blast from the past. I remember that from the .NET launch. I still think it's a really awesome initiative, and this sort of thing would be great for getting high school kids interested in programming.

Re: Two Programs Enter, One Program Leaves

#23
post #3

Microsoft did something similar to promote the .NET framework in it's early days. They launched the Terrarium competition http://terrarium2.codeplex.com/ where you would code your creature's AI in C# or Managed C++ and ship it as a DLL that would compete against other peoples creatures.

Woah. Blast from the past. I remember that from the .NET launch. I still think it's a really awesome initiative, and this sort of thing would be great for getting high school kids interested in programming.

They've got one for Azure now, I haven't checked it out though:

http://www.rockpaperazure.com/

Re: Two Programs Enter, One Program Leaves

#24

I couldn't find a Javascript environment for running this. Anybody knows if it exists? If not, who's up for a github night ? ;-)

I've been thinking about creating one, having been an active Corewars player back in the day.

A problem could be compatibility with the pmars parser, which has been the standard for a long time. I tried writing a parser for corewars years ago and run into trouble emulating some aspects of the pmars parser.

Re: Two Programs Enter, One Program Leaves

#25
The nice thing about them is that they are very short and so you can try a lot of different strategies, but there were also long scripts like Mule DNA. I think this is a great way to teach kids the basics of addressing and low level programming. I remember writing these bots for a friends computer science class, good times.

Re: Two Programs Enter, One Program Leaves

#26
post #8

Back in the day I tried applying genetic algorithms to corewars as a high school science fair project. I lost. They had no idea what was talking about. Early lesson in the importants of communicating technical ideas.

Three weeks ago, I was at a science fair demonstrating a genetic algorithm that would create AIs for two-player boardgames, and included a test case with tic-tac-toe.

Guys from the IEEE talked to me at length, loved it, and gave me their grand prize. Two judges (both Lisp hackers (and both thrilled to see an 18-year old doing AI with CL)) also loved it...but the other judges did not understand it at all, so I didn't even place at the actual fair. Sigh.

Re: Two Programs Enter, One Program Leaves

#28
I would like to share with you a funny story about Corewar:

5 or 6 years ago, a group of students at the local university organized a Corewar contest. The group of organizers were, how to say it, "theorethical nerds", some of them in their way to be professors (two of them are in fact professors today). Big egos too.

I was no more a student at the time so I didn't join the contest, but I commented about it to my girlfriend because I had read about Corewar before and found it interesting. My girl was a student and she liked so much what I told her, that she decided to compete herself.

I can say that when she is obsessed with something, as she got with the contest, she doesn´t stops at anything. So in less than a couple of weeks she had serveral 'strains' of working bots each with different behaviours and abilities. Until the last minute she was testing which were her bests programs to compete.

So, the day arrived, and the more or less 10 MALE ppl at the competition saw my girl, coming with no one but 3 (or 4) programs. I wish I could have been at the event because my girl beat them all and with all of her bots. They even disqualified one of her bots because it almost always tied (was a replicator)

I don't think they learned not to underestimate a confident blonde girl, but the contest was conveniently forgotten and Corewar was never mentioned again at the place :D.

Re: Two Programs Enter, One Program Leaves

#29
post #24

I couldn't find a Javascript environment for running this. Anybody knows if it exists? If not, who's up for a github night ? ;-)

I've been thinking about creating one, having been an active Corewars player back in the day. A problem could be compatibility with the pmars parser, which has been the standard for a long time. I tried writing a parser for corewars years ago and run into trouble emulating some aspects of the pmars parser.

yep I'm currently wrestling with it. I've a prototype that precompiles EQU and FOR/ROF and I'll try uploading it to github when it's a bit more tested.
Post reply on HN