Example #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);
 }
Example #2
0
 public Edge this[EdgePosition pos]
 {
     get
     {
         Hexagon hex = GetHexagonOrNull(pos.HexPosition);
         return hex != null ? hex[pos.Orientation] : null;
     }
 }
Example #3
0
 IEdge IBoard.this[EdgePosition pos]
 {
     get { return this[pos]; }
 }
Example #4
0
 public BuildLinkMove(EdgePosition where)
 {
     WhereAt = where;
 }
Example #5
0
 public void UnBuildLink(EdgePosition whereAt)
 {
     this[whereAt].Reset();
 }
Example #6
0
 public void UndoBuildLink(EdgePosition whereAt)
 {
     Board.UnBuildLink(whereAt);
     CurrentUniversity.RemoveLink(Board[whereAt]);
 }
Example #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));
 }
Example #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);
     }
 }
Example #9
0
 public void HashEdge(Color color, EdgePosition ePos)
 {
     Edge edge = _game.Board[ePos];
     Hash ^= _coloredHashing[color].LinkHash[edge];
 }
Example #10
0
 public void HashEdge(Color color, EdgePosition ePos)
 {
 }