Welcome
Members
Calendar
Mailing List
Links
Perl 101
Perl 201
Snippets
Projects
Books
Two or more programs run in a single address space in a vm that simulates a strange computer, and each program tries to disable all instances of the other. Replicating around memory, trashing memory randomly, overwritting every nth byte were all fair play. Each program got exactly one machine cycle (each instruction took one) before the VM moved to the next thread. You won when all of the other threads crashed. Winning solutions tended to be brilliant combinations of all strategies but even simple permutations were fun.

It would be fun to do something like that with Perl. Perl 5.8 threads would work well enough for time sharing. I'm just not sure what metaphor to use for addressable memory since Perl's bytecode tree is a tree. Also the only way I can think of replicate code around memory is eval(), since assinging globs and creating closures don't actually copy bytecode tree, only bump refcounts.

Using the name table in place of the memory of a bytecode tree would be an obvious guess, but a thread can keep running with an empty symbol table once it starts - the code just has to not try to call other functions, which is easy with a busy spin loop, making the ultimate winning solution while(1) { }, which is pretty lame.

Hrm. On second though, taking B::Generate (my favorite module) to the AST and duking it out there sounds like a lot of fun... each thread could be handed the root nodes of the AST and let loose.

The key parts of B::Generate could be posted to the list with a note that the upcoming contest will require understand of them. Cheat sheets for perl ops and B::Generate syntax would be provided at the meeting. Sample programs that demonstrate basic replication and basic annihilation behavior could be provided as a starting point.

Obviously I don't have time to put this together for this week, but is this something that you would consider for future meetings? It would be exclusive in that newbies would be completely lost and there wouldn't be enough time for anything more than a simple solution but people take things home and work on things at home for future contests without ruining the sport.




· Home Page · Edit This Page · Reverse Links · Expand Links · Recent Changes