[Freeciv-Dev] Re: the directional system
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Mon, Sep 10, 2001 at 01:13:47AM -0400, Ross W. Wetmore wrote:
> At 10:08 AM 01/09/09 +0200, Raimar Falke wrote:
> >On Sun, Sep 09, 2001 at 03:39:51AM -0400, Jason Dorje Short wrote:
> >> Raimar Falke wrote:
> >>
> >> > I still don't understand it. DIR_DX2 is only used in one method. Why
> >> > not just convert this and be fine (at least as an immediate step) with
> >> > one system. Why to switch all over to the DIR_DX2 system? Why is the
> >> > DIR_DX2 inferior to the DIR_DX system (not the naming but the
> >> > ordering)?
> >>
> >> The problem is the DIR_DX2 "rotational" system is superior to the DIR_DX
> >> "vertical" system:
> >
> >> easier to code with
> >
> >This should be a non issue if you use "enum direction8" and iterate
> >macros.
>
> Only if you are taking the complete set, or known absolute directions
> which is what those two constructs are there for.
>
> > About
> >which algorithms do we speak here?
>
> I'm happy to see you recognize that there might be other things. It is
> a good first step, at least.
>
> Try to write an algorithm to move a unit in direction "dir" 50% of the
> time and in the next compass direction forwards or backwards 25% each.
>
> BTW, in the "rotation" system these directions are dir+1 and dir-1,
> so this is stepping (dir + (myrand(4)*2-3)/2).
>
> Try to write dir_ok and straightest_direction using the maximal amount
> of common code. Note that dir_ok is a one-line function in corecleanup
> that should be obvious if you worked through the preceding example.
In a lot of place we removed dependencies on the direction system. I'm
sure we will also solve this DIR_DX2 case. So we have code base which
is independent of the direction system. You than suggest we should
loose this flexibility because two methods can be expressed in a
simpler way. This will only happen if these method are moved to map.h
(or a new dir.h) and surrounded by a big fat comment telling that
these methods depend on a certain system. I would may be also add
extra runtime checks like "assert(DIR_DX[0])==0;..." to ensure that
the system will not change under our feets. But even then I'm not sure
if I would make these changes. dir_ok and straightest_direction can be
expressed in a way that is independent of the direction
system. However if you show a performance improvement of some amount
you may convince me. Thinking about this a bit more: the only current
code which should be treated in the way above mentioned (fat warning,
extra checks) is DIR_REVERSE.
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
Make a software that is foolproof, and only fools will want to use it.
- [Freeciv-Dev] Re: the directional system, (continued)
- [Freeciv-Dev] Re: the directional system, Ross W. Wetmore, 2001/09/10
- [Freeciv-Dev] Re: the directional system, Raimar Falke, 2001/09/11
- [Freeciv-Dev] Re: the directional system, Ross W. Wetmore, 2001/09/10
- [Freeciv-Dev] Re: the directional system, Ross W. Wetmore, 2001/09/10
- [Freeciv-Dev] Re: the directional system, Thue, 2001/09/10
- [Freeciv-Dev] Re: the directional system, Ross W. Wetmore, 2001/09/10
- [Freeciv-Dev] Re: the directional system, Thue, 2001/09/11
- [Freeciv-Dev] Re: the directional system,
Raimar Falke <=
- [Freeciv-Dev] Re: the directional system, Jason Dorje Short, 2001/09/10
- [Freeciv-Dev] Re: the directional system, Raimar Falke, 2001/09/10
- [Freeciv-Dev] Re: the directional system, Ross W. Wetmore, 2001/09/10
- [Freeciv-Dev] Re: the directional system, Raimar Falke, 2001/09/11
- [Freeciv-Dev] Re: the directional system, Reinier Post, 2001/09/10
|
|