Wired Up And Fired Up

      Software of distinction

Apropos of nothing...
We've been playing with Windows PowerShell at a client site a little recently. Largely, on my part, for amusement but also to see how 'the other half' do things. It's an (almost) proper shell for Windows and it's not half bad, slow as Christmas, but not bad.

My ex-colleague Adrian, aka millinad has been doing a lot more with it than I could ever be bothered to so, if you're interested I suggest you check out his blog about it.

We also knocked out a mostly functional Space Invaders clone. Hoo Hoo Ha! As Dr. Kawashima would say (repeatedly).

My contribution to the world of computer science and powershellian advancement is a fully functional Brainf*ck interpreter written in PowerShell. For those of you who don't know brainf*ck is a minimalist programming language comprising of only 8 instructions. Yes, eight. None the less it is Turing Complete and capable of computing any computable function of simulating any other computational model (just not very easily).

Still, I found it an interesting exercise and thought I'd share...

bf.ps1 - The PowerShell brainf*ck interpreter (thanks to Nik Crabtree for speeding up the 'memory' initialization)
add.bf - Adds two single-digit integers together (so long as the result is < 9)
triangle.bf - Draws the Sierpinski triangle
pi.bf - Calculates pi to 15 digits (if you can be bothered to wait, it took me 10 minutes to get to the 3!)

Oh, right, and Hello World which, for those of you who've yet to sample the delights of the language I've also printed below...

>+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]>++++++++[<++++>-]<.>+++++++++++[<++++++++>-]<-.--------.+++.------.--------.[-]>++++++++[<++++>-]<+.[-]++++++++++.

You can run the programs in PowerShell with : ./bf.ps1 add.bf

Why am I writing about this? I couldn't think of anything pithy to say about the iPhone other than that, yes, I want one. And I had this kicking around for a rainy day and guess what - it's raining.
|