Ok。だから私はこれを思いつきます:
public class Room
{
public class OrientedRoom{
Direction dir;
Room disoriented;
OrientedRoom(Direction dir, Room disoriented){
this.dir = dir;
this.disoriented = disoriented;
}
public int Cols{
get{
if(dir==Direction.North || dir == Direction.South)
return disoriented.cols;
else
return disoriented.rows;
}
}
public int Rows{
get{
if(dir==Direction.North || dir == Direction.South)
return disoriented.rows;
else
return disoriented.rows;
}
}
public string this[int i, int j]{
get{
switch(dir){
case Direction.West: return disoriented.map[Cols-j-1, i];break;
case Direction.South:return disoriented.map[Rows-i-1, Cols-j-1];break;
case Direction.East: return disoriented.map[j,Rows-i-1]; break;
case Direction.North:return disoriented.map[i, j];break;
}
}
}
}
public readonly int cols;
public readonly int rows;
private string[,] map;
public int score;
public string name;
public enum Direction{North, South, East, West};
public OrientedRoom rot(Direction dir){
return new OrientedRoom (dir, this);
}
それを改善する方法についての提案を喜んでお聞きします。