private static bool move(Pirate p, Location t, int moves, IPirateGame game) { foreach (Location l in game.GetSailOptions(p, t, moves)) { if (!game.IsOccupied(l) || game.GetPirateOn(l).Owner != p.Owner) { game.SetSail(p, l); return(true); } } game.Debug("Failed to find a move for " + p.Id); return(false); }