HDTenEightyP/NetNews huggingface dataset:
From: lowry@watson.ibm.com (Andy Lowry)
Subject: Re: FULL HOUSE (REVISED)
Date: Mon, 14 Sep 1992 18:38:46 GMT
Disclaimer: This posting represents the poster's views, not necessarily those of IBM
Organization: IBM T.J. Watson Research Center

In article <1992Sep13.223147.28768@wuecl.wustl.edu> ppc1@cec1.wustl.edu (Peter Pui Tak Chiu) writes:
 > // this previous version of this program assumes that we are drawing from
 > // an infinite deck.  (which is a bug).
 > 
 > // now this version has no such problem...

 > int getRandom(){
 > int n,BAD=1;
 > while(BAD){
 > n=rand()%52+1;
 > for(int i=0;i<5;i++){
 > 	int FLAG=0;
 > 	if(n==hand[i])FLAG=1;
 > 	if(!FLAG)BAD=0;
 > 	}}
 > return(n);
 > }

Try again.  Trace through an execution of getRandom when you've
already dealt out {10,34,18} and then getRandom tries to deal 34
again.  Surprise!  It succeeds in doing so.  It turns out the only
case you've avoided with your fix is dealing the same second card as
first card.

--
Andy Lowry, lowry@watson.ibm.com, (914) 784-7925
IBM Research, P.O. Box 704, Yorktown Heights, NY  10598
Organization: Johannes Kepler University Linz - Computing Center
Date: Monday, 14 Sep 1992 11:33:56 CDT
From: <K3021E7@ALIJKU11.BITNET>
Newsgroups: comp.programming
Subject: Algorithms for STYX (=Maniax)

This one is to all who ever saw the C64 game STYX or the Amiga game Maniax
or know what they're about.
I'm trying to program a game of this sort, as simple as possible, and in C.
I thought it might be simple, but I encountered problems where even my
beloved "Algorithms in C" - Sedgewick couldn't help me.

THE GAME: You are controlling a point which draws a line after it. You can't go
 back. You can't cross your own line. When you hit a BORDER line, the polygone
you made gets filled and your former line now becomes the new BORDER line.
You can move only horizontally and vertically, not diagonal.
There is SOMETHING evil. In the old C64 version there were some lines that
moved around, in the Amiga Maniax it's a few sprites.
Once the evil thing hits your line (or even yourself), you're lost.
You win if you manage to fill 75% of the screen.

THE PROBLEMS: Once the player hits a border line, the interior of the polygon
has to be filled. Since it CAN happen that the filled part is more than 50% of
the rest, you can't just fill the smaller polygon but you must fill the one
were the bad creature ISN'T inside.
So HOW TO DETECT IF let's say just ONE POINT (the coords of the monster)
IS IN THE POLYGON ?

The next problem is - when you have two lines exactly beside each other
(which means, no room in between), a normal flood fill algorithm would
stop. In this game, the colour should "FLOW THROUGH" the corridor.
I think I need to reprogram the normal Flood Fill Algorithm with a few
changes, but how does the normal Flood Fill work ???

The next problem: The game has to finish when 75% of the screen are covered.
How do I calculate the interior of some WEIRD polygon ?
I'd have to split it up into something rectangular, but HOW should I do this
algorithmically ???

One more problem: How can I detect if the monster hit my line ? If the thing
should look like in the C64 version, this might become difficult because I'd
have to check EACH single pixel. However, this isn't necessary. I can also use
sprites or something like this which would make it a lot easier.

So does anybody have an idea of how to solve at least ONE of those problems ?

Oh, by the way - I'm using Lattice on an Amiga 500+.

Thanks in advance to you all,
please please please e-mail me,
Michael "Iglo"




Newsgroups: comp.programming
From: ppc1@cec1.wustl.edu (Peter Pui Tak Chiu)
Subject: FULL HOUSE (REVISED)
Organization: Washington University, St. Louis MO
Date: Sun, 13 Sep 1992 22:31:47 GMT



// this previous version of this program assumes that we are drawing from
// an infinite deck.  (which is a bug).

// now this version has no such problem...
// but still the probability is around 0.004...
// which is four times the theoretical value 0.001441

// what's wrong???!!!

#include <iostream.h>
#include <time.h>
#include <stdlib.h>
#include <math.h>

static int hand[5];
long COUNTER=0, GOOD=0;

int getRandom(){
int n,BAD=1;
while(BAD){
n=rand()%52+1;
for(int i=0;i<5;i++){
	int FLAG=0;
	if(n==hand[i])FLAG=1;
	if(!FLAG)BAD=0;
	}}
return(n);
}

void init(){
for(int i=0;i<5;i++)hand[i]=0;
for(i=0;i<5;i++)hand[i]=getRandom();
for(i=0;i<5;i++)hand[i]=hand[i]%13;
}

int fullhouse(){
int counter[13],flag2=0,flag3=0;
for(int i=0;i<13;i++)counter[i]=0;
for(i=0;i<5;i++)counter[hand[i]]++;
for(i=0;i<13;i++){
	if(counter[i]==2)flag2++;
	if(counter[i]==3)flag3++;
	}
return(flag2&&flag3);
}

main(){
randomize();
while(1){
COUNTER++;
init();
if(fullhouse())GOOD++;
if(!fmod(COUNTER,10000))cerr<<COUNTER<<double(GOOD)/COUNTER<<"\n";
}}


Newsgroups: comp.programming
From: jbm@hal.trl.OZ.AU (Jacques Guy)
Subject: Re: Pascal vs C
Organization: Telecom Research Labs, Melbourne, Australia
Date: Tue, 15 Sep 1992 21:44:23 GMT

Well, if you do not mind Windows hogging your hard disk,
what about Visual Basic? It is the best possible introduction
to object-oriented programming and multitasking. Forces
you into the right habits and frame of mind for OOP.
That's from someone who started with Algol, went on
to Simula 67, then C, then Pascal and stuck with it
for years. A jab at Smalltalk, too. Once you've
mastered Visual Basic you'll be well-equipped for
C++ or Ada. Even the syntax is not so alien, more
like an Algol-type language than the sort of Basic
we all have in mind when we hear the name.
Newsgroups: comp.programming
Subject: Pascal vs C
From: nimcompu@oneb.almanac.bc.ca
Date: Mon, 14 Sep 92 19:26:52 PDT
Organization: The Old Frog's Almanac, Nanaimo, B.C.
Summary: Which is better?

Ok.  I'm just one of thos guys that is just comming onto the programming 
scene.  I have gone through what I think is quite a bit of Pascal.  But what 
I would like to know is whick language (Pascal or C) is better for 
programming in and why.   I don't need anything detailed but just something 
to give me an idea.  Thanks.

           nimcompu@oneb.almanac.bc.ca (Eric van Wiltenburg)
     The Old Frog's Almanac  (Home of The Almanac UNIX Users Group)    
(604) 245-3205 (v32)    <Public Access UseNet>    (604) 245-4366 (2400x4)
        Vancouver Island, British Columbia    Waffle XENIX 1.64
From: jrh@mustang.dell.com (Randy Howard)
Newsgroups: comp.programming
Subject: Re: Pascal vs C
Date: 15 Sep 92 03:43:22 GMT
Organization: Dell Computer Co

nimcompu@oneb.almanac.bc.ca writes:

>Ok.  I'm just one of thos guys that is just comming onto the programming 
>scene.  I have gone through what I think is quite a bit of Pascal.  But what 
>I would like to know is whick language (Pascal or C) is better for 
>programming in and why.   I don't need anything detailed but just something 
>to give me an idea.  Thanks.

Oh boy.. not this thread again..  but to make it simple.. if you want a job,
learn C.  Otherwise, do whatever you feel most comfortable with.  :)

-- 
Randy Howard            _o	    @'s: jrh@dell.com
Dell Computer Corp.     \<,	    !'s: ...!uunet!dellunix!jrh
______________________()/ ()______________________________________________
"Univel"... Just Say "NoNIX"
Newsgroups: comp.programming
From: dak@messua.informatik.rwth-aachen.de (David Kastrup)
Subject: rand() quality. Was: Re: FULL HOUSE (SOLUTION)
Organization: Rechnerbetrieb Informatik  /  RWTH Aachen
Date: 15 Sep 92 12:53:41 GMT


rand() is maybe not that bad. It only gets misused too often. Using it
by modulo is the wrong attitude, because the value is distributed more
or less evenly, not the bits (the less bits you extract, the worse you get).
Use rand/(MAXUNSIGNED/52 + 1) instead of rand%52.
From: watson@maths.uwa.oz.au (David Watson)
Newsgroups: comp.programming
Subject: Re: Help - Contour drawing algorithm needed
Date: 9 Sep 1992 04:33:54 GMT
Organization: The University of Westrn Australia
NNTP-Posting-Host: madvax.maths.uwa.oz.au

tpradeep@cs.tamu.edu (Pradeep K Tapadiya) writes:

>Given a set of (x,y,t) points where (x,y) represent the cooridinate and
>(t) represents the associated temperature, I need to draw temperature
>contours over a specified region. Can someone suggest me an algorithm
>to do this, or refer me to the right book(s).

For a survey of interpolation methods for bivariate data -

ftp cod.nosc.mil  /pub/grid.ps
ftp cod.nosc.mil  /pub/grid.tex
ftp cod.nosc.mil  /pub/grid.ascii

The comments in this survey are extracted from the book

CONTOURING: A Guide to the Analysis and Display of Spatial Data 
by David F. Watson           ISBN  0 08 040286 0
to be published by Pergamon Press in the last quarter of 1992.

Promotional material about this book will be sent to anyone who 
sends their address to

Sue Cloke
Senior Marketing Manager
Earth & Environmental Sciences
Pergamon Press Ltd
Headington Hill Hall
Oxford OX3 OBW
UK

For a FORTRAN program to interpolate and contour with linear triangle-
based technique
		ftp garbo.uwasa.fi  /pc/source/contour.f

A gridding program that uses natural neighbor interpolation, NNGRIDR,
is available commercially.  Send email to me for details.

--
Dave Watson                          Internet: watson@maths.uwa.edu.au
Department of Mathematics            
The University of Western Australia               Tel: (61 9) 380 3359
Nedlands, WA 6009  Australia.                     FAX: (61 9) 380 1028
Newsgroups: comp.programming
From: David Ruggiero <osiris@halcyon.com>
Subject: Algorithm for sunrise/sunset given lat/long? (probable FAQ)
Originator: osiris@halcyon.com
Reply-To: David Ruggiero <osiris@halcyon.com>
Organization: [none - why fight entropy?]
Date: Wed, 16 Sep 1992 03:04:20 GMT

[As stated in the subject line, I'm sure it has come up in this group
before. Sorry, but...]

Given the latitude/longitude for a given location, is there an approxiamate
algorithm for determining sunrise and sunset times for that location for
a given date?

(Yes, I know that local time zones are fairly strange, with
non-linear boundaries...I'm interested in the 'sun time' rather than the
'civilization time' as a first cut. And for the level of accuracy I'm looking
for, oddities like the effect of leap years and altitude are similarily
unimportant.)


While we're at it, anyone know of an FTP-able program for the PC or Mac
that shows the world map with day/night curve superimposed upon it for a
given date/time? I've seen a [hideously expensive] standalone 'simulator'
in several high-priced catalogs that does this, but nothing in the way of
a program.

Mucho thanks for any information or speculation...

David
-- 
David Ruggiero  (osiris@halcyon.com)      Seattle, WA
Xref: sparky comp.programming:2613 comp.theory:1925
From: mtj@babar.asd.sgi.com (Michael Jones)
Newsgroups: comp.programming,comp.theory
Subject: Re: Proving fair shuffles (was: FULL HOUSE)
Date: 15 Sep 92 16:21:53 GMT
Distribution: comp
Organization: Silicon Graphics, Inc.

In article <...>, schnitzi@cs.ucf.edu (Mark Schnitzius) writes:
|> I've been wondering...
|> 
|> Assuming you have a true random number generator, is there
|> a way to _prove_ that a particular algorithm performs an
|> honest shuuffle (i.e. each card has equal possibility of 
|> being in each place)?  Are there any order(n) shuffling
|> routines?
|> 
|> Mark Schnitzius
|> schnitzi@eola.cs.ucf.edu
|> University of Central Florida

Certainly such an algorithm exists, and is O(n):

   old: array of cards in some order {such as a new deck}
   new: empty array

   while (old not empty)
       begin
       select a card in old at random
       remove card from old
       add card to new (anywhere: front, back, ...)
       end

This will do just what you ask. Since "remove a card" and
"select a card" are messy for arrays (requires moving
cards down after removal, multiple random probes, or the
advance-and-skip loop) a more common sequence is the one
in my posted solution:

    old: array of 52 cards in any order

    for (i = 0; i < 52; i++)
       swap card[i] and card[random() % 52];

-- Michael Jones    mtj@sgi.com  415.390.1455  M/S 7L-590
		    Silicon Graphics, Advanced Graphics Division
		    2011 N. Shoreline Blvd., Mtn. View, CA 94039-7311
From: brnstnd@nyu.edu (Dan Bernstein)
Newsgroups: comp.programming
Subject: --- comp.programming charter: read before you post (weekly notice)
Date: 13 Sep 92 04:00:10 GMT
Organization: IR

comp.programming	Programming issues that transcend languages and OSs.

It is a matter of courtesy to read a USENET group for at least a month
before posting anything to it. You should be familiar with this article
and with all the regular announcements in news.announce.newusers. A
newsgroup is like a crowded meeting hall filled with people who want to
talk about similar subjects. Chances are that if you just stick your
head in and shout, you'll be saying something totally inappropriate or
asking a question which someone else asked last week, and everyone will
be angry at you. To avoid this, _read_ before you post.

What you _should_ post here (the charter):

	comp.programming is an unmoderated group for discussions of
	programming issues which are not limited to a specific machine,
	operating system, or language: in particular, algorithms of all
	types. ``Programming issues'' means _practical_ programming
	issues: it is considered very bad form here to discuss issues
	with which you do not have direct programming experience.

What you _should not_ post here:

	Any issue which is limited to a specific machine, operating
	system, or language is completely inappropriate for this group.
	If you are programming under UNIX, use comp.unix.programmer. If
	you are programming a PC, use comp.os.msdos.programmer. If you
	are programming a Mac, use comp.sys.mac.programmer. If you are
	programming an Amiga, use comp.sys.amiga.programmer. If you are
	programming a game and think that your question is of interest
	to other game programmers, use rec.games.programmer. If you're
	absolutely sure that your question is on the use of the C
	language---it wouldn't make sense if you were using a different
	language---try comp.lang.c. If your question is a meta-question
	which has to do with features of various programming languages,
	use comp.lang.misc. If your question has to do with theoretical
	results which have to do with computer science rather than
	programming, try comp.theory. Finally, if you're sure that your
	question would make sense under a variety of operating systems,
	running on a variety of machines, and in a wide variety of
	programming languages, then comp.programming is probably right.

	Note added 3/9/92: If you want source code for something, you'll
	get better response in comp.sources.wanted, which was created to
	handle such requests.

Other comp.programming conventions:

	It's often difficult to talk about programming without quoting
	the results of that programming---i.e., code. There is nothing
	wrong with using a particular language to present code samples,
	as long as they _could_ have been expressed in various other
	languages. However, you are less likely to have your question
	understood if you illustrate it with a choice segment of APL
	than if you use pseudo-code, Algol, C, etc.

For future reference, comp.programming passed by a vote of 403-47. It
was created 3/1/92.

---Dan
From: gvw@epcc.ed.ac.uk (Greg Wilson)
Newsgroups: comp.programming
Subject: Small DE Simulation System Wanted
Date: 14 Sep 92 11:40:41 GMT
Organization: Edinburgh Parallel Computing Centre

I am looking for a small discrete-event simulation system to use as a
testbed for developing some ideas about parallel programming languages,
and for teaching parallel programming.  My plan is to compile several
parallel dialects of a simple Pascal-like language into the simulation
language, and then let the simulation package worry about scheduling,
memory allocation, etc.

My requirements are:

1) Simplicity --- as the simulation system is going to be the target of
   a compiler, I would like it to be as simple as possible.  I need the
   sort of functionality present in Simula + DEMOS, but probably nothing
   more than that.

2) Visualisability --- both for my own use, and for future use by
   students, it is essential that it be easy to display what's going
   on, e.g. what processes are blocked (and why).  (This is where
   Simula + DEMOS falls down --- no intrinsic visualisation...)

3) Low Cost --- while I suppose it's too much to hope that a PD system
   exists, something cheap enough to be purchased and used for educational
   purposes would be nice.

Any pointers anyone can give me would be very welcome.

Thanks,

Gregory V. Wilson
gvw@epcc.ed.ac.uk
<------------------------------ Actual Size ------------------------------>
Xref: sparky comp.programming:2615 comp.theory:1928 sci.math.num-analysis:2732
From: hoey@zogwarg.etl.army.mil (Dan Hoey)
Newsgroups: comp.programming,comp.theory,sci.math.num-analysis
Subject: Re: Proving fair shuffles (was: FULL HOUSE)
Date: 15 Sep 92 17:33:21 GMT
Followup-To: comp.programming
Organization: Naval Research Laboratory, Washington, DC

schnitzi@cs.ucf.edu (Mark Schnitzius) writes:

>Assuming you have a true random number generator, is there
>a way to _prove_ that a particular algorithm performs an
>honest shuffle (i.e. each card has equal possibility of 
>being in each place)?  Are there any order(n) shuffling
>routines?

Yes, and yes, and the algorithm's in Knuth, and it's faqfully posted
here and there (it was in comp.sources.d less than a month ago)
possibly because it's a frequently assigned homework exercise.  But
that still doesn't prevent mtj@babar.asd.sgi.com (Michael Jones) from
posting the egregious pseudo-shuffle

bad> for (card = 0; card < 52; card++)
bad>    {
bad>    swap = random() % 52;
bad>    temp = deck[card];
bad>           deck[card] = deck[swap];
bad>                        deck[swap] = temp;
bad>    }

or yenne@austin.eds.com (Britt Yenne) from misshuffling the first five
cards with lossage like

bad>    for(i = 0; i < 5; i++)
bad>    {
bad>        n = random() % 52;
bad>        s = card[n];
bad>        card[n] = card[i];
bad>        card[i] = s;
bad>    }

Even dak@messua.informatik.rwth-aachen.de (David Kastrup), offering
the good advice to

> Use rand/(MAXUNSIGNED/52 + 1) instead of rand%52.

doesn't mention that always folding rand to a 52-element range is the
commonest, most obvious sign of an incompetent shuffler.

But, you may notice, I have not provided a corrected shuffling
algorithm!  Think of it as an incentive to go read Knuth, or a Pons
Asinorum for the lazy student.

Dan Hoey
Hoey@AIC.NRL.Navy.Mil
From: Graham.Shaw@newcastle.ac.uk (G.D.Shaw)
Newsgroups: comp.programming
Subject: Re: FULL HOUSE
Date: 13 Sep 92 20:52:03 GMT
Organization: University of Newcastle upon Tyne, UK NE1 7RU

In article <1992Sep13.144411.25033@wuecl.wustl.edu> ppc1@cec1.wustl.edu (Peter Pui Tak Chiu) writes:
>
>hi everyone,
>
>i am trying to find the probability of getting a hand of full house from a
>shuffled deck of 52 cards.
>
>...
>
>but i wrote a c program to calculate this probability and the results turn
>out to be very different.
>
To summarise your dealing algorithm:

- you choose five random numbers between 0 and 12
- you then throw away any hand where all five numbers are the same.

Suppose, for example, the first card you choose is a ten.

The probability of drawing a ten as the second card, by the above
algorithm, is still 1 in 13.  Unfortunately, this will not work:
having drawn one ten, there are only 3 tens left in the remaining
pack of 51 cards, so the probability of a ten should be 3/51, and
of any other card should be 4/51.

To solve the problem correctly, you must keep track of exactly
which cards remain in the pack, and assign each of those cards an
equal probability.  Note that this also avoids the need to test
each hand for legality after it has been dealt, as it ensures
that such combinations cannot occur.

Graham Shaw (dph3gds@tuda.ncl.ac.uk)
Department of Physics, Durham University, England
From: ae684@cleveland.Freenet.Edu (Jeffrey Schmidt)
Newsgroups: comp.programming
Subject: Help Needed: Microsoft C
Date: 12 Sep 1992 17:11:36 GMT
Organization: Case Western Reserve University, Cleveland, Ohio (USA)
NNTP-Posting-Host: slc10.ins.cwru.edu


I'm trying to write a modem interface useing QuickC 2.5 and haveing
no luck.  Any suggestions would be greatly appreciated. I've
got a PM/2400 in an IBM ps/2 55sx.
Thanx.
-- 
The preceding was yet another useless 
thing I typed with many typoos!
From: as789@cleveland.Freenet.Edu (Francisco J. Diaz)
Newsgroups: comp.programming
Subject: Clipper 5.01 & Turbo C 2.01
Date: 10 Sep 1992 22:39:32 GMT
Organization: Case Western Reserve University, Cleveland, Ohio (USA)
NNTP-Posting-Host: hela.ins.cwru.edu


Hi all...
	 I want to know if i can link Turbo C 2.001 routines
with my Clipper 5.01 programs . In the manuals i read that i may
be possible if i have Microsoft C (5.1 or later). I want
to know if i can use Turbo C 2.01.
	Also i want to know if there is a later version of the 
nmanforum library(i have the 2.0). Thanks
-- 
|     Francisco J. Diaz Rivera     |                           |
|     University of Puerto Rico    | If the shoe fits, buy it! |
|    "I hate MATH classes!" :-)    |           - Imelda Marcos |
|     STUD137@CUTB.UPR.CLU.EDU     |                           |
Newsgroups: comp.programming
From: crawford@church.mitre.org (Randy Crawford)
Subject: Re: Pascal vs C (DON'T)
Organization: The MITRE Corporation, McLean, VA
Date: Tue, 15 Sep 1992 15:03:53 GMT

In article <HBF5qB1w164w@oneb.almanac.bc.ca>, nimcompu@oneb writes:
>whick language (Pascal or C) is better for programming in and why.


'Scuse me.  Anybody here read the charter for this newsgroup?

Is clearly says (posted 2 days ago):

> If your question is a meta-question
> which has to do with features of various programming languages,
> use comp.lang.misc.

This is an algorithmic, numeric, computational, theoretical, and
philosophical newsgroup discussing meta-issues, not specific languages
or OSs, nor comparing them.

Thenk yew.
-- 

| Randy Crawford        crawford@mitre.org        The MITRE Corporation
|                                                 7525 Colshire Dr., MS Z421
| N=1 -> P=NP           703 883-7940              McLean, VA  22102