Пример #1
0
 public Edge(Hexagon hex, EdgeOrientation so)
 {
     AdjacentForUpdate.Add(hex);
     _originalHexagon = hex;
     _originalOrientation = so;
     Position = new EdgePosition(_originalHexagon.Position, _originalOrientation);
     _cache = new EdgeCache(this);
 }
Пример #2
0
 public Edge this[EdgePosition pos]
 {
     get
     {
         Hexagon hex = GetHexagonOrNull(pos.HexPosition);
         return hex != null ? hex[pos.Orientation] : null;
     }
 }
Пример #3
0
 IEdge IBoard.this[EdgePosition pos]
 {
     get { return this[pos]; }
 }
Пример #4
0
 public BuildLinkMove(EdgePosition where)
 {
     WhereAt = where;
 }
Пример #5
0
 public void UnBuildLink(EdgePosition whereAt)
 {
     this[whereAt].Reset();
 }
Пример #6
0
 public void UndoBuildLink(EdgePosition whereAt)
 {
     Board.UnBuildLink(whereAt);
     CurrentUniversity.RemoveLink(Board[whereAt]);
 }
Пример #7
0
 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));
 }
Пример #8
0
 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);
     }
 }
Пример #9
0
 public void HashEdge(Color color, EdgePosition ePos)
 {
     Edge edge = _game.Board[ePos];
     Hash ^= _coloredHashing[color].LinkHash[edge];
 }
Пример #10
0
 public void HashEdge(Color color, EdgePosition ePos)
 {
 }