using System; namespace Project { class Program { public static void Main() { World world = new World(10, 8); world[1, 5] = 5; PrintWorld(world); Console.ReadKey(); } public static void PrintWorld(World world) { for (int y = 0; y < world.Height; y++) { for (int x = 0; x < world.Width; x++) Console.Write("{0} ", world[x, y]); Console.WriteLine(); } } public class World { private int[,] world; public int Width => world.GetLength(1); public int Height => world.GetLength(0); public World(int width, int height, int defaultValue = 0) { world = new int[height, width]; for (int y = 0; y < height; y++) for (int x = 0; x < width; x++) world[y, x] = defaultValue; } public bool IsCoordinatesCorrect(int x, int y) { return x >= 0 && x < Width && y >= 0 && y < Height; } public int this[int x, int y] { get => world[y, x]; set => world[y, x] = value; } } } }