Esempio n. 1
0
 public bool Equals(Aisle other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(Room0.Equals(other.Room0) && Room1.Equals(other.Room1));
 }
Esempio n. 2
0
        /// <summary>
        /// 接続している反対側の部屋を取得
        /// </summary>
        /// <param name="origin"></param>
        /// <returns></returns>
        /// <exception cref="MazeException"></exception>
        public Room GetCounterSide(Room origin)
        {
            // 自分ではない方を返す
            if (Room0.Equals(origin))
            {
                return(Room1);
            }

            if (Room1.Equals(origin))
            {
                return(Room0);
            }

            // どちらも自分でなければエラー
            throw new MazeException("This aisle is not connected to the room");
        }