Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2002:
[Freeciv-Dev] Re: movement
Home

[Freeciv-Dev] Re: movement

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: "Per I. Mathisen" <per@xxxxxxxxxxx>
Cc: Freeciv developers <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: movement
From: Raimar Falke <rf13@xxxxxxxxxxxxxxxxx>
Date: Wed, 14 Aug 2002 15:54:36 +0200

On Wed, Aug 14, 2002 at 01:14:07PM +0000, Per I. Mathisen wrote:
> On Wed, 14 Aug 2002, Raimar Falke wrote:
> > > How about (simpler version): You must either have sufficient movement to
> > > enter a piece of terrain, or, you must use _all_ your movement to do so.
> > > Attempting to move into terrain with insufficient moves drains all your
> > > movement.
> >
> > This is the current rule.
> 
> No, the current rule also allows you a rand() chance of entering the tile
> without full movement.

The current try_move_unit

bool try_move_unit(struct unit *punit, int dest_x, int dest_y)
{
  if (myrand(1+map_move_cost(punit, dest_x, dest_y))>punit->moves_left &&
      punit->moves_left<unit_move_rate(punit)) {
    punit->moves_left=0;
    send_unit_info(unit_owner(punit), punit);
  }
  return punit->moves_left > 0;
}

is hard to read. The following is IMHO equivalent and makes it more
clear (and shows that you don't to rand() if you have full moves):

bool try_move_unit(struct unit *punit, int dest_x, int dest_y)
{
  if (punit->moves_left == 0) {
    return FALSE;
  }

  if (punit->moves_left == unit_move_rate(punit)) {
    return TRUE;
  }

  if (myrand(1 + map_move_cost(punit, dest_x, dest_y)) > punit->moves_left) {
    punit->moves_left = 0;
    send_unit_info(unit_owner(punit), punit);
    return FALSE;
  }
  return TRUE;
}

> Greg's suggestion equals always succeeding with this rand(), my suggestion
> equals always failing this rand().
> 
> > > This way we don't need to implement the "automatic move at beginning of
> > > turn" part, which I don't like.
> >
> > Do you agree that it the fairest so far? The second fairest IMHO is
> > the current one.
> 
> How is one more "fair" than the other?

Ok I have to take this back. It is hard to define what is fair. Two
issues come to mind:
 - slow units should be able to move to every terrain
 - remaining points at the end of the turn shouldn't be wasted but
 also not more useful than the others

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 Q:  Do you know what the death rate around here is?
 A:  One per person.


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