示例#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)
 {
 }