On Dec 12, 2007 11:36 AM, Ed Murphy <[EMAIL PROTECTED]> wrote: > Wooble wrote: > > > I didn't try to figure out how to actually go about computing primes; > > how to do any sort of useful conditional statements was beyond me > > (since submitting my program I read up a bit on brainfuck algorithms > > and should probably be better equipped for the next task, but it would > > have felt like cheating to use other people's code and insight for the > > contest, even though that's a big part of real world coding; I mean, > > why not just submit someone else's code that already computes primes, > > since it's not exactly a novel task and there are undoubtedly tons of > > Googleable solutions to the problem out there already). > > I'd heard of BF before, but this was my first time actually trying to > write a program in it. I did yoink Wikipedia's example of how to > implement a loop. > > > I didn't > > quite store the primes in memory (which now looks like it might have > > made for a smaller program), instead I wrote code to print each one > > individually, using just 2 memory locations for digits and 1 for the > > NL character, incrementing or decrementing each of the 2 digits and > > switching between them in what seemed, purely by intuition, to be the > > most efficient way. > > I did much the same thing, but with more locations, more movement and > less **crementing. Further optimization is the sort of thing that Mel > the Real Programmer might have done to relax.
I came very close to writing a perl program that was going to figure out for me the optimal steps to take to do things this way, which also seemed a bit like cheating. Then I briefly toyed with the notion of writing a Brainfuck program to help figure out how to best write the other program, but that just gave me a headache. -- Geoffrey Spear http://www.geoffreyspear.com/

