AIsOfCatan.GameController.RoadConnected C# (CSharp) Method

RoadConnected() private method

Figure out if a given edge on the board is connected to a given players road in some end
private RoadConnected ( IBoard board, Edge edge, int playerId ) : bool
board IBoard
edge Edge The edge to check
playerId int The id of the player to test
return bool
        private bool RoadConnected(IBoard board, Edge edge, int playerId)
        {
            return board.GetAdjacentIntersections(edge)
                     .SelectMany(inter => board.GetAdjacentEdges(inter))
                     .Any(e => board.GetRoad(e) == playerId);
        }