예제 #1
0
 public bool Equals(FieldState other)
 {
     if ((object)other == null) return false;
     if (!this.Name.Equals(other.Name)) return false;
     if (!this.Width.Equals(other.Width) || !this.Height.Equals(other.Height)) return false;
     for (var x = 0; x < this.Width; ++x)
     {
         for (var y = 0; y < this.Height; ++y)
         {
             if (!this.Cells[x][y].Equals(other.Cells[x][y]))
             {
                 return false;
             }
         }
     }
     return true;
 }
예제 #2
0
 public GameState(FieldState field, IList<PlayerState> players)
 {
     this.Field = field;
     this.Players = players.ToList().AsReadOnly();
 }
예제 #3
0
 /// <summary>
 /// 与えられた位置がフィールド内か否かを調べる。
 /// </summary>
 /// <param name="field">フィールド</param>
 /// <param name="pos">位置</param>
 /// <returns>位置がフィールド内なら true 、そうでなければ false</returns>
 public static bool IsIn(FieldState field, PositionState pos)
 {
     return pos.X >= 0 && pos.Y >= 0 && pos.X < field.Width && pos.Y < field.Height;
 }