public Edge(Hexagon hex, EdgeOrientation so) { AdjacentForUpdate.Add(hex); _originalHexagon = hex; _originalOrientation = so; Position = new EdgePosition(_originalHexagon.Position, _originalOrientation); _cache = new EdgeCache(this); }
public Edge this[EdgePosition pos] { get { Hexagon hex = GetHexagonOrNull(pos.HexPosition); return hex != null ? hex[pos.Orientation] : null; } }
IEdge IBoard.this[EdgePosition pos] { get { return this[pos]; } }
public BuildLinkMove(EdgePosition where) { WhereAt = where; }
public void UnBuildLink(EdgePosition whereAt) { this[whereAt].Reset(); }
public void UndoBuildLink(EdgePosition whereAt) { Board.UnBuildLink(whereAt); CurrentUniversity.RemoveLink(Board[whereAt]); }
public bool IsLegalToBuildLink(EdgePosition pos) { Edge edge = Board[pos]; if (edge == null || edge.Color != null) { return false; } if (CurrentPhase == GamePhase.Play) { return edge.Adjacent.Edges.Any(e => e.Color == CurrentUniversityColor); } // links to own campus IVertex vertex = edge.Adjacent.Vertices.SingleOrDefault( v => v.Campus != null && v.Campus.Color == CurrentUniversityColor); if (vertex == null) { return false; } // but not the same campus one as the other link return !edge.Adjacent.Edges.Any(e => e.Color == CurrentUniversityColor && e.Adjacent.Vertices.Contains(vertex)); }
public void BuildLink(EdgePosition whereAt) { var edge = Board[whereAt]; Board.BuildLink(edge, CurrentUniversity.Color); CurrentUniversity.AddLink(edge); Hashing.HashEdge(CurrentUniversityColor, edge.Position); if (CurrentPhase == GamePhase.Play) { Hashing.HashMostInfo(LongestInternetLink.University, MostInfoType.Links); LongestInternetLink = LongestInternetLink.GetMore(CurrentUniversity, CurrentUniversity.LengthOfLongestLink); Hashing.HashMostInfo(LongestInternetLink.University, MostInfoType.Links); } }
public void HashEdge(Color color, EdgePosition ePos) { Edge edge = _game.Board[ePos]; Hash ^= _coloredHashing[color].LinkHash[edge]; }
public void HashEdge(Color color, EdgePosition ePos) { }