Live data from Hacker News

Two Programs Enter, One Program Leaves

codinghorror.com

31–38 of 38 posts

Re: Two Programs Enter, One Program Leaves

#31

In university, we did something vaguely similar for class projects using Robocode: http://robocode.sourceforge.net/

Which was inspired by Robot Battle on Windows, which was inspired by Robot Wars on the Apple ][.

I played Robot Wars on the Apple ][. And Rocky's Boots and A Robot Odyssey. Awesome games for hacker/maker personalities. And yes, I'll be on my rocker.

Re: Two Programs Enter, One Program Leaves

#32
I'm reminded of a story I read a while back (around 20 years ago) about engineers pointing out a security flaw in a vendor's Unix system, which the vendor did not take seriously. So they wrote a pair of programs: Falstaff and Othello, if I remember correctly... where if you killed one, the other would output to the console something to the effect of "I'll save you!" and would resurrect the other program, making it extremely difficult to eradicate from the system.

I've been trying to find this... anyone have a reference to the original?

Re: Two Programs Enter, One Program Leaves

#33
post #32

I'm reminded of a story I read a while back (around 20 years ago) about engineers pointing out a security flaw in a vendor's Unix system, which the vendor did not take seriously. So they wrote a pair of programs: Falstaff and Othello, if I remember correctly... where if you killed one, the other would output to the console something to the effect of "I'll save you!" and would resurrect the other program, making it ex…

That sounds like a story that is recounted in the Jargon File (http://www.catb.org/jargon/html/meaning-of-hack.html).

I wonder if it's a bit apocryphal. I feel sure I've also read a version where the two processes were called “sheriff” and “deputy”, and you suggested yet a third naming scheme.

“Back in the mid-1970s, several of the system support staff at Motorola discovered a relatively simple way to crack system security on the Xerox CP-V timesharing system. Through a simple programming strategy, it was possible for a user program to trick the system into running a portion of the program in ‘master mode’ (supervisor state), in which memory protection does not apply.

[…]

Months passed. The Motorola guys pestered their Xerox field-support rep, to no avail. Finally they decided to take direct action, to demonstrate to Xerox management just how easily the system could be cracked and just how thoroughly the security safeguards could be subverted.

They dug around in the operating-system listings and devised a thoroughly devilish set of patches. These patches were then incorporated into a pair of programs called ‘Robin Hood’ and ‘Friar Tuck’. Robin Hood and Friar Tuck were designed to run as ‘ghost jobs’ (daemons, in Unix terminology); they would use the existing loophole to subvert system security, install the necessary patches, and then keep an eye on one another's statuses in order to keep the system operator (in effect, the superuser) from aborting them.

One fine day, the system operator on the main CP-V software development system in El Segundo was surprised by a number of unusual phenomena. […] Naturally, the operator called in the operating-system developers. They found the bandit ghost jobs running, and killed them... and were once again surprised. When Robin Hood was gunned, the following sequence of events took place:

  !X id1     id1: Friar Tuck... I am under attack!  Pray save me!   id1: Off (aborted)     id2: Fear not, friend Robin!  I shall rout the Sheriff       of Nottingham's men!

  id1: Thank you, my good fellow!

Each ghost-job would detect the fact that the other had been killed, and would start a new copy of the recently slain program within a few milliseconds. The only way to kill both ghosts was to kill them simultaneously (very difficult) or to deliberately crash the system.”

Re: Two Programs Enter, One Program Leaves

#34
post #32

I'm reminded of a story I read a while back (around 20 years ago) about engineers pointing out a security flaw in a vendor's Unix system, which the vendor did not take seriously. So they wrote a pair of programs: Falstaff and Othello, if I remember correctly... where if you killed one, the other would output to the console something to the effect of "I'll save you!" and would resurrect the other program, making it ex…

That sounds like a story that is recounted in the Jargon File ( http://www.catb.org/jargon/html/meaning-of-hack.html ). I wonder if it's a bit apocryphal. I feel sure I've also read a version where the two processes were called “sheriff” and “deputy”, and you suggested yet a third naming scheme. “Back in the mid-1970s, several of the system support staff at Motorola discovered a relatively simple way to crack system…

Thank you... that is the one. I may have misremembered the characters involved or perhaps read it from a different source.

Re: Two Programs Enter, One Program Leaves

#35
post #24

Earlier quoted context omitted.

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.

Even a JS Corewars interpreter that can only compile "assembly" would be nice to have. Then people could compile their warriors with pmars and put fancy simulations on their web sites. Not saying that it is impossible to clone the pmars compiler, but it is a mess :-)

Re: Two Programs Enter, One Program Leaves

#36
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.

In recent years some evolved warriors were able to compete with human crafted warriors. Optimizing just parts of a warrior with GAs is also a popular method.

Re: Two Programs Enter, One Program Leaves

#37
post #35

Earlier quoted context omitted.

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.

Even a JS Corewars interpreter that can only compile "assembly" would be nice to have. Then people could compile their warriors with pmars and put fancy simulations on their web sites. Not saying that it is impossible to clone the pmars compiler, but it is a mess :-)

I've got the precompiler working quite well. Interestingly, it translates the redcode/pMARS code line-to-line to Javascript which is then executed to produce the assembly.

redcode is indeed a mess, clearly the result of an evolving and blurry standard :)

anyway, I'm spitting out assembly for 90% of the bots I've tried and have the Imp running. From now on it will indeed be a job of implementing each instructions and addressing modes. I'm definitely uploading this on github in a few hours and will be very happy to have some help ! :)

Re: Two Programs Enter, One Program Leaves

#38
post #35

Earlier quoted context omitted.

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.

Even a JS Corewars interpreter that can only compile "assembly" would be nice to have. Then people could compile their warriors with pmars and put fancy simulations on their web sites. Not saying that it is impossible to clone the pmars compiler, but it is a mess :-)

There you go !

https://github.com/joshfire/corewarjs

I've got imps and a few other running :)

Post reply on HN