Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

dependency generator posted to net.sources

1 view
Skip to first unread message

Kenneth Ng

unread,
Jun 11, 1986, 5:07:39 AM6/11/86
to

References: <15...@ecsvax.UUCP> <bentley.853> <4...@cubsvax.UUCP> <9...@ttrdc.UUCP>
Organization: NJ Inst of Tech., Newark NJ

In article <9...@ttrdc.UUCP>, le...@ttrdc.UUCP (Daniel R. Levy) writes:
> _18 line_ fortran game of life? Can you post that (in net.lang.f77 of course)?
It's been quite some time since my school account was rolled
out into the bit bucket, therefore I had to reconstruct this
from scratch, but its pretty close. The school compiler I
used allowed fortran programs to not have the "STOP" and
"END" statements, although it generated warnings.

INTEGER A(10,10)/100*0/, B(10,10), C(10,10)
READ(5,10)((A(I,J),J=2,9),I=2,9)
10 FORMAT(8I1)
DO 100 COUNT = 1,50
DO 50 I = 2,7
DO 50 J = 2,7
SUM=A(I-1,J-1)+A(I-1,J)+A(I-1,J+1)+A(I,J-1)+A(I,J+1)
>+A(I+1,J-1)+A(I+1,J)+A(I+1,J+1)
B(I,J)=0
50 IF(SUM.EQ.3).OR.((SUM+A(I,J)).EQ.3)B(I,J)=1
DO 60 I=2,9
DO 60 J=2,9
C(I,J) = ' '
IF (B(I,J).EQ.1)C(I,J) = '*'
60 A(I,J) = B(I,J)
100 WRITE(6,70)COUNT,((C(I,J),J=2,9),I=2,9)
70 FORMAT('1 Gen ',I3,/,'0',8('*'),/,8(' |',8A1,'|',/),'0',8('*'),/)
STOP
END

--
Kenneth Ng: uucp(unreliable) ihnp4!allegra!bellcore!njitcccc!ken
bitnet(prefered) k...@njitcccc.bitnet

New Jersey Institute of Technology
Computerized Conferencing and Communications Center
Newark, New Jersey 07102

Vulcan jealousy: "I fail to see the logic in prefering Stonn over me"
Movie "Short Circuit": Number 5: "I need input"

--
Kenneth Ng: uucp(unreliable) ihnp4!allegra!bellcore!njitcccc!ken
bitnet(prefered) k...@njitcccc.bitnet

New Jersey Institute of Technology
Computerized Conferencing and Communications Center
Newark, New Jersey 07102

Vulcan jealousy: "I fail to see the logic in prefering Stonn over me"
Movie "Short Circuit": Number 5: "I need input"

Daniel R. Levy

unread,
Jun 13, 1986, 2:06:19 AM6/13/86
to
In article <2...@njitcccc.UUCP>, k...@njitcccc.UUCP writes:
>In article <9...@ttrdc.UUCP>, le...@ttrdc.UUCP (Daniel R. Levy) writes:
>> _18 line_ fortran game of life? Can you post that (in net.lang.f77 of course)?
>It's been quite some time since my school account was rolled
>out into the bit bucket, therefore I had to reconstruct this
>from scratch, but its pretty close. The school compiler I
>used allowed fortran programs to not have the "STOP" and
>"END" statements, although it generated warnings.
>Kenneth Ng: uucp(unreliable) ihnp4!allegra!bellcore!njitcccc!ken

Well, maybe you should have tested it too :-). Anyhow here is a slightly
hacked version which does work-- not 18 lines though, more like 22 (I made
C into a character array since that worked better with f77 on a big-endian
3B).

IMPLICIT INTEGER (A-Z)
INTEGER A(10,10), B(10,10)
CHARACTER C(10,10)
DATA A /100 * 0/


READ(5,10)((A(I,J),J=2,9),I=2,9)
10 FORMAT(8I1)
DO 100 COUNT = 1,50

DO 50 I = 2,9
DO 50 J = 2,9
SUM=A(I-1,J-1)+A(I-1,J)+A(I-1,J+1)+A(I,J-1)+A(I,J+1)
>+A(I+1,J-1)+A(I+1,J)+A(I+1,J+1)
B(I,J)=0
50 IF((SUM.EQ.3).OR.((SUM+A(I,J)).EQ.3))B(I,J)=1


DO 60 I=2,9
DO 60 J=2,9
C(I,J) = ' '
IF (B(I,J).EQ.1)C(I,J) = '*'
60 A(I,J) = B(I,J)
100 WRITE(6,70)COUNT,((C(I,J),J=2,9),I=2,9)

70 FORMAT(' Gen ',I3,/,2X,8('*'),/,8(' |',8A1,'|',/),2X,8('*'),/)
STOP
END
--
------------------------------- Disclaimer: The views contained herein are
| dan levy | yvel nad | my own and are not at all those of my em-
| an engihacker @ | ployer or the administrator of any computer
| at&t computer systems division | upon which I may hack.
| skokie, illinois |
-------------------------------- Path: ..!{akgua,homxb,ihnp4,ltuxa,mvuxa,
vax135}!ttrdc!levy

Kenneth Ng

unread,
Jun 15, 1986, 2:31:39 PM6/15/86
to
In article <9...@ttrdc.UUCP>, le...@ttrdc.UUCP (Daniel R. Levy) writes:
> In article <2...@njitcccc.UUCP>, k...@njitcccc.UUCP writes:
> >In article <9...@ttrdc.UUCP>, le...@ttrdc.UUCP (Daniel R. Levy) writes:
> >> _18 line_ fortran game of life? Can you post that (in net.lang.f77 of course)?
> >It's been quite some time since my school account was rolled
> >out into the bit bucket, therefore I had to reconstruct this
> >from scratch, but its pretty close. The school compiler I
> >used allowed fortran programs to not have the "STOP" and
> >"END" statements, although it generated warnings.
> >Kenneth Ng: uucp(unreliable) ihnp4!allegra!bellcore!njitcccc!ken
>
> Well, maybe you should have tested it too :-). Anyhow here is a slightly
> hacked version which does work-- not 18 lines though, more like 22 (I made
> C into a character array since that worked better with f77 on a big-endian
> 3B).
Thanks, I'm keeping a printed copy of this, which hopefully
won't also end up in the bit bucket. While I do have access
to a fortran here, its a pain in the rear to use, but I should
have tested it. This program was prompted by a teaching
assistent who said he had written the shortest possible game
of life in 50 or so lines of fortran.

--
Kenneth Ng: uucp(unreliable) ihnp4!allegra!bellcore!njitcccc!ken

soon uucp:k...@rigel.cccc.njit.edu
bitnet(prefered) k...@njitcccc.bitnet
soon bitnet: k...@orion.cccc.njit.edu
(Yes, we are slowly moving to RFC 920, kicking and screaming)

0 new messages