That's what it's all about

Aug 14, 2008 15:04


Warning - today's post is waaay more geeky than usual.
If you're not comfortable with fundamental-level programming concepts, best skip this one..

OK, I've rabbited on loads about Graphjam of late, but one more time.. Found a charming flow chart diagram for the Hokey Cokey, and it struck me the dance is essentially a series of FOR (or DO or WHILE etc) loops.

Surely someone must have done at least a pseudo-code version of it? Apparently not, according to a few Google searches.

And so, from the school of 'because I can', I bring you...

THE HOKEY COKEY IN VBScript

Dim body_part

Dim body(4)
        body(0)="left arm"
        body(1)="right arm"
        body(2)="left leg"
        body(3)="right leg"
        body(4)="whole self"

function in_out(item)

response.write( "You put your " & item & " in,
" )
        response.write( "You put your " & item & " out,
" )

end function

function in_out_short()

response.write( "In, out
" )

end function

for body_part=0 to UBound(body) step 1
        response.write( "
" )
        in_out(body(body_part))
        dim put
        for put=0 to 1
            in_out_short()
        next
        response.write( "Shake it all about.
" )
        response.write( "You do the hokey cokey and you turn around,
" )
        response.write( "That's what it's all about.
" )
    next

I'm sure this isn't as efficient as it could be, mind - put that down to me trying to translate the little I know of PHP and JavaScript into VB in the time I had..
If anyone has any suggestions for making it leaner and meaner, please drop them by - it could be fun to put in the Wikipedia entry for the Hokey Cokey :)

I'd also be keen to get a 'foreign language' option - just in case, y'know, you fancied a Hokey Cokey in German:

image Click to view



I really oughta get me one of those life things I keep hearing about...
Previous post Next post
Up