Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2001:
[Freeciv-Dev] Re: Map coordinate cleanups.
Home

[Freeciv-Dev] Re: Map coordinate cleanups.

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Map coordinate cleanups.
From: Arien Malec <arien_malec@xxxxxxxxx>
Date: Fri, 17 Aug 2001 09:32:01 -0700 (PDT)

Just to add to this very clear schematization:

For any grid system:

Set A (possible points) is the cartesian product N X N

Set C (normalized points) is the cartesian product  {n | 0 <= n < x} X {n | 0
<= n < y}

Set B (real or normalizable points) has the following values:

For the x & y wrapped world, B = A
For the unwrapped flat earth, B = C
For the x-only-wrapped (Freeciv default) world, B = N X {n | 0 <= n < y}
For the y-only-wrapped world, B = {n | 0 <= n < x} X N

Yes?

BTH, wouldn't a sensible way of implementing normalization be to generate at
game initalization a suitably big array mapping coordinate positions to
normalized coordinate positions? E.g., if the map is the maximum of 200x100,
and sensible moves are < x/2 or y/2 (since if you go more than halfway around
the map, you might as well go the other way), you would generate a 300X150
array of ints, each cell of which would contain either the normalized position,
or NULL (if the position is irreal).

That moves the tricky, expensive, and topology-dependent stuff to a one-off
operation, and should make the implementation of is_real, is_normal, etc. and
the iterate macros very very simple....

Arien

--- Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> wrote:
> On Fri, Aug 17, 2001 at 05:19:35AM -0700, Trent Piepho wrote:
> > On Fri, 17 Aug 2001, Raimar Falke wrote:
> > > I have to admit I haven't learned the difference between proper and
> > > normal during my coding. Maybe I have used too much copy and paste. I
> > > think there should be the following sets of positions/tiles:
> > 
> > proper is some new thing Gaute came up with.  So you haven't seen it
> > before.
> > 
> > >  A = the base set of all possible positions
> > >  B = the set of real positions: a real position is a position which have
> > >  directly or indirectly a tile associated with it
> > >  C = the set of normalized positions: each tile has exactly one
> > >  normalized position associated with it
> > >  D = A minus B = the set of unreal positions
> > >  E = B minis C = the set of unnormalized positions
> > > 
> > > B is a subset of A. C is a subset of B. Depending on the topology
> > > these are subsets or proper subsets.
> > > 
> > > The following methods are declared:
> > >  - is_real_position(p) tests if p is in B
> > >  - is_normalized_position(p) tests if p is in C
> > >  - p'=normalize_position(p) p must be in B, returns the normalized
> > >  version of p
> > 
> > That is what makes the most sense to me too.  It's also what I've
> understood
> > to to be the existing code all along now.  The function is_real_tile()
> already
> > exists, and is_normal_tile() has been in some patches for quite a while.
> > 
> > What Gaute has done is make it so that C is no longer a subset of B, as it
> > includes non-real positions in the normalized form.  Then he defined a
> fourth
> > set, he called proper, that is the same as your set C.  There are still the
> > same two useful subsets of A, now called real and proper, and one new
> useless
> > subset called normal.
> 
> So for simplicity sake we should stick to the schema above. Except
> when Gaute comes up with a good reason for his classification.
> 
>  Raimar
> 
> -- 
>  email: rf13@xxxxxxxxxxxxxxxxx
>  Make a software that is foolproof, and only fools will want to use it.
> 

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/


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