Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2001:
[Freeciv-Dev] Re: PATCH: rand_pos function and usage (PR#1017)
Home

[Freeciv-Dev] Re: PATCH: rand_pos function and usage (PR#1017)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: rf13@xxxxxxxxxxxxxxxxxxxxxx
Cc: jdorje@xxxxxxxxxxxxxxxxxxxxx, freeciv-dev <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: PATCH: rand_pos function and usage (PR#1017)
From: "Ross W. Wetmore" <rwetmore@xxxxxxxxxxxx>
Date: Wed, 24 Oct 2001 00:53:57 -0400

At 10:43 AM 01/10/23 +0200, Raimar Falke wrote:
>On Mon, Oct 22, 2001 at 07:04:18PM -0400, Jason Dorje Short wrote:
>> "Ross W. Wetmore" wrote:

The idea is good, but in general the application is sufficiently 
different that a single interface probably doesn't make sense.

In general the programmer can decide whether the number of elements
selected warrants a filtered, or pure random approach, and whether one 
wants to do this on a full map, or some reasonable subset as part of
the process.

The issue here is the one-size-fits-all philosophy. 

I think you shouldn't do this in places like map generation where 
generic random techniques make really poor generators of realistic 
maps.

Having spent some time working over mapgen, and got it to produce
much more interesting and realistic results, the approach suggested
here is exactly the opposite to what is really needed.

>It looks like the filter approach and the "classical" approach both
>have cases were one is faster. What do you think about a general
>interface:
>
>#define RAND_POS(x, y, pos_check,max_count)
>   if(max_count==0)
>      RAND_POS_CHECKED(x,y,pos_check);
>   else
>   {
>    do {
>      x=myrand(map.xsize);
>      y=myrand(map.ysize);
>    } while (!(pos_check(x,y)) && max_count-->0);
>   }
>
>Now the programmer can choose based on number he collected which
>approach he uses.
>
>       Raimar
>-- 
> email: rf13@xxxxxxxxxxxxxxxxx
>  "brand memory are for windows users that think their stability
>   problems come from the memory"
>    -- bomek in #freeciv

Cheers,
RossW
=====




[Prev in Thread] Current Thread [Next in Thread]