Я предлагаю создать перечисление битового флага, как показано ниже.
[Flags]
public enum WallLocations
{
None = 0,
Left = 1,
Right = 2,
Top = 4,
Bottom = 8
}
Затем вы можете использовать словарь для сопоставления местоположений стен с изображениями.
Dictionary<WallLocations, Image> map = new Dictionary<WallLocations, Image>();
map.Add(WallLocations.None, image0000);
map.Add(WallLocations.Left, image1000);
map.Add(WallLocations.Right, image0100);
map.Add(WallLocations.Top, image0010);
map.Add(WallLocations.Bottom, image0001);
map.Add(WallLocations.Left | WallLocations.Right, image1100);
// ....
По крайней мере, в C # вы также можете расширить определение enum на все 16 случаев.
[Flags]
public enum WallLocations
{
None = 0,
Left = 1,
Right = 2,
Top = 4,
Bottom = 8,
LeftAndRight = Left | Right,
LeftAndTop = Left | Top,
LeftAndBottom = Left | Bottom,
RightAndTop = Right | Top,
RightAndBottom = Left | Bottom,
TopAndBottom = Top | Bottom,
AllExceptLeft = Right | Top | Bottom,
AllExceptRight = Left | Top | Bottom,
AllExceptTop = Left | Right | Bottom,
AllExceptBottom = Left | Right | Top,
All = Left | Right | Top | Bottom
}