🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.games
Article #2451

Re: Battleship source for Unix w/curses

#2451
From: David C. Kovar
Date: Mon, 24 Mar 1986 04:17
19 lines
1422 bytes
>> My problem, however, is with the pattern that the ships are set up in.  
>> The first time you play the game (every time you play it) the pattern that
>> the ships are in is identical.

>That's easy. Just insert a "srand(getpid());" somewhere in the beginning
>of the program, before the first "rand" call.

That'll still have the same problem. getpid() will return the same pid
each time the same user runs it, thus you would get the same seed for
rand each time. Try srand(time()); instead.

-- 
David C. Kovar    
    USNET:      {ihnp4|linus|decvax|cornell|astrovax}!dartvax!davidk%amber
    ARPA:	davidk%amber%dartmouth@csnet-relay
    CSNET:	davidk%amber@dartmouth

" It's the policies of debugging, it's the Programmer's Blues ...
  Programmer's Blues ... "
Technical Details
Message-ID: <4336@dartvax.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!dartvax!davidk
References: <314@drivax.UUCP> <9200033@uiucdcs>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84; site dartvax.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!dartvax!davidk
From: davidk@dartvax.UUCP (David C. Kovar)
Newsgroups: net.games
Subject: Re: Battleship source for Unix w/curses
Message-ID: <4336@dartvax.UUCP>
Date: Sun, 23-Mar-86 23:17:30 EST
Article-I.D.: dartvax.4336
Posted: Sun Mar 23 23:17:30 1986
Date-Received: Wed, 26-Mar-86 04:15:59 EST
References: <314@drivax.UUCP> <9200033@uiucdcs>
Reply-To: davidk@dartvax.UUCP (David C. Kovar)
Organization: Dartmouth College, Hanover, NH
Lines: 19