Showing posts with label I really suck at python. Show all posts
Showing posts with label I really suck at python. Show all posts

Thursday, December 11, 2008

Took a while, but...

Pybrain v. 4, my poorly written Brainfuck interpreter, is a success!

Yes, Pybrain v. 1 - 3 did not work. Version 3, the lengthiest, had 177 lines of code. Version 4 currently has 61. It's not complete yet, as I still have to add support for running it as a standalone script and executing a given file instead of just strings from the Python interpreter. Once I polish it up a bit, I suppose I'll post it here.

Version 3 was a complete rewrite (as was the later version 4), and was very object-oriented. Given that resounding failure, I'm not sure that was the best way to go. Perhaps choice of programming paradigm should not be based on one's ability to work bad, stupid puns into the program (e.g. naming the cell class BrainCells).

Tuesday, December 9, 2008

Yup, another infinite loop

This one isn't as obvious as that last one. Still looking.

In the meantime, Foreman and Thirteen totally just made out. Saw it coming from a mile away.
Or like five seconds. I dunno.

I am a complete idiot and I suck at not being a complete idiot

Turns out the problem causing the infinite loop in the Brainfuck interpreter was, well, an infinite loop. I know, I know, it must've been hard for me to catch. Please hold the applause.

I had forgotten to implement the somewhat important part where, you know, the while loop actually works. I had forgotten to add a check to see if the current cell is 0, thus making the loop somewhat useless.

Now I'll go try some other code and probably find new bugs.
Oh boy.