Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2001:
[Freeciv-Dev] Re: [PATCH] more small directional cleanups
Home

[Freeciv-Dev] Re: [PATCH] more small directional cleanups

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: "Ross W. Wetmore" <rwetmore@xxxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [PATCH] more small directional cleanups
From: Trent Piepho <xyzzy@xxxxxxxxxxxxx>
Date: Wed, 22 Aug 2001 12:45:40 -0700 (PDT)

On Wed, 22 Aug 2001, Ross W. Wetmore wrote:
> 
> But his code is about 2-3 times more expensive for the standard case and

How so?  I think the generation of the random number is the most expensive
part, and I only do that once for the common case.

> I think that the problem of calling rand_neighbour() to generate a random
> adjacent tile when there are no adjacent tiles is a programming error that

It's not so much calling it when there're are no possibilities, but that you
depend on randomly finding one of the valid neighbors.  You could guess a
random number 1000 times and still not find it.  It seems bad to me
to depend on "luck" to keep your code from locking up.



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