public Edge[] GetPossibleRoads(int playerID)
{
List<Edge> result = new List<Edge>(15);
foreach(Edge edge in this.GetAllEdges()){
// must be empty
if (roads.ContainsKey(edge)) continue;
foreach (Intersection inter in this.GetAdjacentIntersections(edge))
{
// must not be other players piece at intersection
Piece atInter = this.GetPiece(inter);
if (atInter != null && atInter.Player != playerID) continue;
// must have one of the players roads connected to one of the end edges
if(this.GetAdjacentEdges(inter).Any(e => this.GetRoad(e) == playerID))
{
result.Add(edge);
break;
}
}
}
return result.ToArray();
}