comp.lang.ada
 help / color / mirror / Atom feed
From: xdragon@ames.net (Brad Dale)
Subject: <no subject>
Date: 1996/12/31
Date: 1996-12-31T00:00:00+00:00	[thread overview]
Message-ID: <5aals2$rlg@bagan.srce.hr> (raw)


Subject: Re: 'Money wanted' algorithm (Cobol version)
Date: Tue, 31 Dec 1996 03:24:55 GMT
Message-ID: <32c8845d.205199674@news.ames.net>
References: <5a8h44$elt@news.inetdirect.net>
X-Newsreader: Forte Free Agent 1.1/32.230
Lines: 70
Path: CARNet.hr!01-newsfeed.univie.ac.at!zeus.cc.ucy.ac.cy!athena.cytanet.com.cy!news-out.internetmci.com!newsfeed.internetmci.com!n5.gbso.net!zot.ames.net
 comp.lang.tcl:31203 comp.mail.eudora.ms-windows:17552 comp.mail.sendmail:17486 comp.multimedia:35901 comp.music.midi:12556 comp.object:28217

On Mon, 30 Dec 96 13:54:10 GMT, spam.free.zone@no-spam.com (Doug
Miller) wrote:


>>>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 thing:
>
>PERFORM WITH TEST AFTER UNTIL hell-frozen-over
>    PERFORM find-empty-coffee-cup
>    PERFORM find-busy-street
>    PERFORM sit-middle-of-street UNTIL sunset
>    PERFORM wait-til-morning
>END-PERFORM
>   

(define get_money
   (lambda (status amount_money)
       (if ((!= status HELLFROZEN) amount_money)
           (+ amount_money  
               (coffee status amount_money))))))

(define coffee
   (lambda (status amount_money)
       (begin
          (1 COFFECAN)
          (find_street status amount_money))))

(define find_street
   (lambda (status amount_money)
     (begin
        (1 STREET)
        (sit_street 0 status amount_money))))

(define sit_street
   (lambda (time status amount_money)
      (if ((= time SUNSET) amount_money)
          (+ (+ amount_money PROFIT) 
              (sit_street (+ 1 time) status amount_money)))))


Written sorta in SCHEME, been awhile so don't be to hard on it
			firehawk@ames.net





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

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-12-31  0:00 Brad Dale [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-01-23 15:56 (no subject) Per Sandberg
2002-10-08  2:18 Rick Duley
2001-05-05 10:43 <no subject> Kent Paul Dolan
2001-05-05  8:25 Kent Paul Dolan
1999-09-15  0:00 (no subject) Justine O'Hara
1999-09-14  0:00 ` Keith Thompson
1998-11-13  0:00 niel.williams
1998-11-13  0:00 ` dennison
1998-11-13  0:00   ` Robert I. Eachus
1997-08-18  0:00 Moustafa abdul wahab
1997-06-03  0:00 Matthew Daniel
1997-01-23  0:00 Mathieu POUPARDIN
1996-12-31  0:00 <no subject> Renegade
1996-06-07  0:00 (no subject) Mark Fisher
1996-04-15  0:00 Markus Knasmueller
1996-04-09  0:00 chico
1996-04-09  0:00 ` David Weller
1996-03-19  0:00 Mike Ibarra
replies disabled

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