Programming Contest: Efficient Editor Usage
Fred (a.k.a. The POTM-MASTER) writes "Anyone can write editors, but it's surprisingly hard to write a program to USE an editor. This latest Programming challenge asks you to write a program that will change one block of text into another using a simple set of 'vim-like' editor commands." (Find the details here.) "Deadline is May 31, 2005 so you've got plenty of time. The POTM is the 'Programmer Of The Month' contest - newly revived and active with about 1000 folks registered for the forums. It is completely for fun - unsponsored and prize-less except for the fame!"
Hardly vim-like... It's missing all the useful stuff like f F t T, all text objects and motions and all the modal stuff. These're the things that make vim so much more powerful than anything else.
But then, I guess "using a few simple manipulation commands" doesn't sound as sexy, eh?
should be changed to a contest to find the most efficient way to do the job. I wrote such a job finisher years ago, and it is used by myself and others to check Project Gutenberg texts.
And my method is capable of learning.
Just use sed, like a RealMan.
Trolling is a art,
That solution fails, by the way, to reproduce the target. I'm using:
>aFIRSTLINEd<>aNEXTLINE
That should reproduce any target, without regard to the input. And I submitted it, we'll see just how well it does. :)
Doug
"'vim-like' editor commands"
Oh no. Don't tell the emacs people about this...
Coder's Stone: The programming language quick ref for iPad
Tied for 6th place!
Doug
I think an obvious approach here is to use a genetic algorithm - literally breed the best collection of editting commands to generate the output.
Reading the rules says that there is a time limit of 60 seconds per program, so it might not be the best approach in reality - but it might be a fun way to attack the problem.
So what's the deal with this?
Use the edit distance algorithm and find all traces transforming the source string into the target string. Then go through all traces and try to chunk them into as big "editing chunks" as possible, which depends on whatever the editing operations they permit.