Saturday, January 15, 2011

Do Not RUN

10 TIE ME KANGAROO DOWN
20 MATE
30 GOTO 10
40 END

Just promise me the offspring won't be allowed to run wild. Kthxbye.

(Cybrus suggests an expansion, thusly:
10 ON (KANGAROO = DEAD) GOTO 50
20 TIE ME KANGAROO DOWN
30 MATE
40 GOTO 10
50 SKIN KANGAROO
60 TAN KANGAROO HIDE
70 INFORM CLYDE
80 HANG ON SHED: KANGAROO HIDE
90 INFORM NED
100 END
I have to point out that if you encounter an immortal kangaroo, you're still stuck in a loop. Also it requires a non-standard version of BASIC.)

It has been suggested that this is cleaner programming:

DO UNTIL KANGAROO = DEAD
TIE ME KANGAROO DOWN
MATE
LOOP
SKIN KANGAROO
(...identical to beta s/w from here to END...)

32 comments:

  1. Yes, GOTO loops are always wrong.

    ReplyDelete
  2. So we tanned his hide when he died, Clyde. That's him hangin' on the shed!

    ReplyDelete
  3. Ah!
    10 ON KANGAROO = DEAD GOTO 50
    20 TIE ME KANGAROO DOWN
    30 MATE
    40 GOTO 10
    50 SKIN KANGAROO
    60 TAN KANGAROO HIDE
    70 INFORM CLYDE
    80 HANG HIDE ON SHED
    90 INFORM NED
    100 END

    ReplyDelete
  4. An immortal kangaroo can only be found in a pocket universe.

    Antibubba

    ReplyDelete
  5. I probably should not mention that Rolf Harris also did cover versions of "Bohemian Rhapsody" (!) and "I Touch Myself" (!!).

    ReplyDelete
  6. Where is the if/then statement in the tree which describes the 'dead' kangaroo variant?

    Sheeesh... tighten it up! Loops and dead code are basically incorrect.

    ReplyDelete
  7. Then:
    DO UNTIL KANGAROO = DEAD
    TIE ME KANGAROO DOWN
    MATE
    LOOP
    SKIN KANGAROO
    (...identical to beta s/w from here to END...)

    ReplyDelete
  8. Now we just need to cover the case where my boomerang won't come back.

    ReplyDelete
  9. "Now we just need to cover the case where my boomerang won't come back."

    It is written in Basic, and Basic doesn't support a recursive function, so your boomarang is gone, John.

    Word verification: eighthol
    A new kind of alcohol?

    ReplyDelete
  10. Or,

    WHILE KANGAROO = ALIVE
      TIE ME KANGAROO DOWN
      MATE
    WEND
    SKIN KANGAROO

    etc.

    Or, since I've been elbow-deep in PHP since early this morning,

    while (kangaroo) {
      tie (kangaroo, me, down);
      mate();
    }
    skin(kangaroo);
    while (!hide_tanned) {
      tan(kangaroo, hide);
    }
    echo "kangaroo hide tanned, clyde!";
    while (!hide_hung_on_shed) {
      hang(hide);
    }
    echo "kangaroo hide hung, ned!";
    exit();

    ReplyDelete
  11. SPOKEN: There's an old Australian stockman lying, dying. He gets himself up
    onto one elbow and 'e turns to his mates, who are all gathered around and 'e says:

    Watch me wallabies feed, mate
    Watch me wallabies feed,
    They're a dangerous breed, mate
    So watch me wallabies feed
    Altogether now!

    CHORUS:
    Tie me kangaroo down, sport
    Tie me kangaroo down
    Tie me kangaroo down, sport
    Tie me kangaroo down

    Keep me cockatoo cool, Curl,
    Keep me cockatoo cool
    Ah, don't go acting the fool, Curl
    Just keep me cockatoo cool
    Altogether now!

    (CHORUS)

    'n' take me koala back, Jack
    Take me koala back
    He lives somewhere out on the track, Mac
    So take me koala back
    Altogether now!

    (CHORUS)

    Let me abos go loose, Lew
    Let me abos go loose
    They're of no further use, Lew
    So let me abos go loose
    Altogether now!

    (CHORUS)

    And mind me platypus duck, Bill
    Mind me platypus duck
    Ah, don't let 'im go running amok, Bill
    Just mind me platypus duck
    Altogether now!

    (CHORUS)

    Play your didgeridoo, Blue
    Play your didgeridoo
    Ah, like, keep playin' 'til I shoot thru, Blue
    Play your didgeridoo
    Altogether now!

    (CHORUS)

    Tan me hide when I'm dead, Fred
    Tan me hide when I'm dead
    So we tanned his hide when he died, Clyde
    And that's it hangin' on the shed!!
    Altogether now!

    ROLF HARRIS, 1963

    per bRUCE
    crankyoldmanwithgun@yahoo.com

    ReplyDelete
  12. H'mmm:

    100 INPUT N 'HOW MANY WALLBIES ARE THERE?'
    200 REM 'N=NUMBER OF WALLABIES'
    300 IF N<2 THEN GOTO 900
    400 INPUT $S 'ARE THEY FEEDING?'
    500 IF $S=NO THEN GOTO 900
    600 PRINT "CONTINUES WATCHING WALLABIES. WARNING: THEY ARE DANGEROUS."
    700 MATE
    800 GOTO 100
    GOSUB 900

    900 REM 'CHORUS. MAY NEED TO MOVE TO END OF PROGRAM'
    1000 FOR I = 1 TO 2
    1100 TIE KANGAROO DOWN
    1200 ENGAGE IN ORGANIZED ATHLETIC COMPETITION
    1300 TIE KANGAROO DOWN
    1400 NEXT
    1450 RETURN

    1500 INPUT M "WHAT IS TEMPERATURE OF COCKATOO?"
    1600 IF M > 68 THEN GTO 2100
    1700 PRINT "BEHAVE IN A SHORT-SPOKEN, SOMEWHAT HOSTILE MANNER"
    1800 INPUT M "WHAT IS TEMPERATURE OF COCKATOO?"
    1900 IF M > 68 THEN GOTO 2100
    2000 GOTO 1500

    2100 GOSUB 900

    (etc.)

    ReplyDelete
  13. Two comments:

    1. GOTO considered harmful.

    2. Ozzie drinking songs considered harmful.

    And in one of my file folders (on dead trees), I have some code showing how to write C in Ada. That, too, is considered harmful.

    I guess that's three comments. I'm now blogging at http://thespanishinquisition.blogspot.com ...

    ReplyDelete
  14. ...I ended up with icky little DO loops last time I tried actual BASIC-esque work...

    ReplyDelete
  15. This comment thread has fallen off the geek end.... er.... I mean the deep end.

    I say this as someone who has actually written code via punch cards once.

    Only once.

    ReplyDelete
  16. I was going to translate it to REXX but then something in my head said, "Dude...nobody cares" :)

    ReplyDelete
  17. One is forced to wonder if there is a word for "The Sensation of Finding Something Hilarious But Being Slightly Embarrassed You Find It Hilarious."

    Whatever it is, I have it.

    ReplyDelete
  18. I don't know what REXX is, but in this crowd you've probably got a shot at finding someone who cares.

    ReplyDelete
  19. This seems like a natural application of functional programming, to me. I may just be in that (unfortunate? long-delayed?) stage of my development.

    ReplyDelete
  20. Like FORTRAN so much better.
    At work we still run FORTRAN, in a DOS shell on a Win97 Pentium 1 box!

    ReplyDelete
  21. Wow, Roberta. Writing code in BASIC in a blog for amusement. You just got a lot cooler to me.

    Which is kinda a bad reflection on me.

    Oh well.

    ReplyDelete
  22. - Out of Cheese Error - +++ Redo From Start +++.

    ReplyDelete
  23. xbase:

    set talk off
    clear

    kcount = 1       &&integer, number of kangaroos, max 28
    verse = 1        &&integer, verse number (1..6,7)
    finished = .f.   &&logical, program runner

    * Main program starts here
    do while (finished=.f.)

      do case
        case (stockman = dying)
          do case
            case (verse=1)
              count=1
              do while !(count < number_wallabies)
                do watch_feed(count)
                count=(count+1)
                loop
                * They're a dangerous breed, mate
              enddo

            case (verse=2)
              do while (cockatoo=hot)
                do cool_cockatoo
                loop
              enddo
              if (Curl_acting_fool=.t.)
                * Throw an error?
              endif

            case (verse=3)

              .
              .
              .

            case (verse=6)
              if (digeridoo_playing=.f.)
                do start_digeridoo
              endif

            case (verse>6)
              * "I'm not dead yet!"
              loop
          endcase
          verse = verse+1

        case (stockman = dead)
          * ----------------------------------------------------------------
          * Note from QC:
          * Rewrite to make sure we did all verses before (stockman=dead)
          * Thanks
          * ----------------------------------------------------------------
          if (digeridoo_playing=.t.)
            do stop_digeridoo
          endif
          if !(hide=tanned)
            do tan_hide &&It's HIS hide, not the kangaroo's!
            ! "So we tanned his hide when he died, Clyde."
            loop
          else
            do hang_on_shed
            ! "and that's it hangin' on the shed!"
          endif
          finished=.t.   &&We're done!
      
        otherwise
         * "I'm alive and doin' fine!"
         loop
      endcase
      
      chorus
      loop

    enddo

    return
    * Main program ends here


    procedure chorus
    * Sung 7 times, four kangaroos each
      loop=1
      * 1-dimensional matrix of kangaroos, kangaroo(n)
      do while (loop<3)   &&i.e., twice
        if !(kangaroo(kcount)=tied)
          do tie_kangaroo_sport(kangaroo(kcount))
        endif
        if !(kangaroo(kcount+1)=tied)
          do tie_kangaroo_notsport(kangaroo(kcount+1))
        endif
        kcount=(kcount+2)
        loop=(loop+1)
      enddo
    return

    ReplyDelete
  24. It's "Tie me kangaroo down, SPORT," not "mate." But the intent is appreciated.

    And the other verse:

    "Mind me platypus duck, Bill,
    Mind me platypus duck,
    Don't ye let 'im go runnin' in the muck, now, Bill;
    Mind me platypus duck!

    All together now . . ." (etc.)

    (Oh. I see someone else has the Rolf Harris album. :) )

    ReplyDelete
  25. SFlorman,

    "It's "Tie me kangaroo down, SPORT," not "mate." But the intent is appreciated."

    Yes, but that's not funny. ;)


    (WV: "whinnesm" After which, the horse lights a cigarette...)

    ReplyDelete
  26. @Don, REXX is an English-like programming language designed by Michael Cowlishaw back in the 1980s. It was intended for IBM mainframes but has been ported to various other platforms.

    I still use it on the z/VM box we run at work and used to use the Windows port (known as Regina) extensively for things that couldn't be easily scripted in the DOS batch command language.

    ReplyDelete
  27. Nathan: I used to use REXX on old DOS PS. Switched to using AWK and also a language called 'builder' that would make batch/script files that you could run interactively. Could set up an interface that looked just like the old TurboC 80x25 block-graphic IDE.

    Ah. Those were the days.

    ReplyDelete
  28. Ok, folks...now in Binary Code...

    (which, once upon a time, I could read and write)

    This is so geeky...and hilarious. Does that mean I am a hilarious geek??

    WV..troutor

    ReplyDelete
  29. I'd like to re-write the thing in Haskell, but I don't think I have the monads to pull it off.

    ReplyDelete

Comment moderation is enabled. Your comment will not be visible until approved. Arguing or use of insulting or derogatory language will result in your comment going unpublished: no name-calling. Comments I deem excessively partisan will not be published.