comp.lang.ada
 help / color / mirror / Atom feed
From: renegade@dwx.com (Renegade)
Subject: Re: 'Money wanted' algorithm (Cobol version)
Date: 1996/12/30
Date: 1996-12-30T00:00:00+00:00	[thread overview]
Message-ID: <32c8f428.76407842@news.dwx.com> (raw)
In-Reply-To: 5a8h44$elt@news.inetdirect.net


congee@mindspring.com (Deric Cheng) wrote:
>dennis@qltel.exonet.nl (Dennis Janssen) wrote:
>
>>Hi Deric,
>
>>**>> I  need alot of money badly; Could anyone help?
>
>>DC> Step 1 Find empty coffee cup
>>DC> Step 2 Find busy Street
>>DC> Step 3 Sit in middle of Street
>>DC> Step 4 goto Step 3 until sun goes down.
>>DC> Stpe 5 goto step 1 in the next day.
>
>>Tsk, tsk, bad advice. Goto's are evil!
>
>>Program Make_Money;
>
>>Uses
>>  Nothing;
>
>>begin
>>  Repeat
>>    Find(EmptyCoffeeCup);
>>    Find(BusyStreet);
>>    Repeat
>>      Sit(MiddleOfStreet)
>>    Until Sun(Down)
>>  Until Hell(FrozenOver)
>>end.
>
>>See mom, I DO have the Christmas spirit!
>
>>   Dennis!
>Hey that's cool can you do it in Cobol?

Sure:

IDENTIFICATION DIVISION.
PROGRAM-ID 	MAKE-MONEY.
AUTHOR	              MY- ASS.
DATE-WRITTEN   TODAY.
ENVIRONMENT DIVISION.
   HOPEFULLY WARM.
DATA DIVISION.

~~~~ YADA, YADA, YADA
01  HELL-IND                 PIC X     VALUE SPACES.
   88 HELL-FROZEN                    VALUE 'Y'.
01   TIME-IND               PIC X      VALUE SPACES.
   88  SUN-DOWN                        VALUE 'Y'.

PROCEDURE DIVISION.

MAIN.
   PERFORM DAILY-ROUNTINE UNTIL HELL-FROZEN.
   STOP-RUN.

DAILY-ROUTINE.
   PERFORM FIND-EMPTY-COFFEE-CUP.
   PERFORM FIND-SPOT WITH TEST AFTER UNTIL LOCATION = "GOOD".
   PERFORM SIT UNTIL SUN-DOWN.
   IF HELL-TEMP < 32 
        MOVE "Y" TO HELL-IND.

FIND-EMPTY-COFFEE-CUP.
   FIND COFFEE-CUP.
   IF COFFEE-CUP NOT = "EMPTY"
        PERFORM EMPTY-CUP.

EMPTY-CUP.
   IF CUP-CONTENTS-APPEAR = "GOOD"
       DRINK CUP-CONTENTS
   ELSE
        POUR CUP-CONTENTS.

FIND-SPOT.
   MOVE "GOOD" TO LOCATION.
   FIND SPOT.
   IF COP-PRESENT = "YES" 
       MOVE "BAD" TO LOCATION.
   IF STREET-BUSY = "NO"
       MOVE "BAD" TO LOCATION.   
   IF BULLETS-FLYING = "YES"
       MOVE "BAD" TO LOCATION.

SIT.
   IF BUTT-ACHES
       MOVE ASS TO OTHER-SIDE.
   SIT STILL.
   LOOK PITIFUL.
   BEG.
   PLEAD.
   IF DARK="YES"
        MOVE "Y" TO TIME-IND.

Please note:   This program was half the size, and worked twice as
well until administration got ahold of it and requested rewrites.  Now
it is bigger, and nobody knows for sure what it does......

Enjoy....

Dave

The opinions expressed in this post are purely my own. 
You may e-mail replies to:   renegade@dwx.com





  parent reply	other threads:[~1996-12-30  0:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-12-30  0:00 'Money wanted' algorithm (Cobol version) Doug Miller
1996-12-30  0:00 ` Beldraen
1996-12-31  0:00   ` Constantinos A. Kotsokalis
1996-12-30  0:00 ` Renegade [this message]
1996-12-30  0:00   ` 'Money wanted' algorithm (Lisp version) Ken Tilton
1996-12-30  0:00   ` 'Money wanted' algorithm (Cobol version) Bill Haverberg
1996-12-31  0:00   ` Bob Jarvis
1996-12-31  0:00     ` Deric Cheng
1996-12-30  0:00 ` Sundial Services
1996-12-31  0:00 ` Robin Becker
1996-12-31  0:00 ` Brad Dale
     [not found]   ` <32C988BA.427D@dynasty.net>
1997-01-01  0:00     ` Pae Choi
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox