using System.Collections.Generic;
using System.Windows.Forms;
public partial class MainForm : Form
private const int PlaygroundSize = 8;
private readonly Dictionary<int, Image> _tiles;
private readonly int[,] _playground;
_tiles = new Dictionary<int, Image>();
var tilesPath = Path.Combine(Application.StartupPath, "Data", "Tiles");
for (int i = 0; i < 2; ++i)
var baseName = i == 0 ? "Gold" : "Sapphire";
_tiles.Add(i * 10 + 1, Image.FromFile(Path.Combine(tilesPath, $"{baseName}_Farmer.png")));
_tiles.Add(i * 10 + 2, Image.FromFile(Path.Combine(tilesPath, $"{baseName}_Jumper.png")));
_tiles.Add(i * 10 + 3, Image.FromFile(Path.Combine(tilesPath, $"{baseName}_King.png")));
_tiles.Add(i * 10 + 4, Image.FromFile(Path.Combine(tilesPath, $"{baseName}_Queen.png")));
_tiles.Add(i * 10 + 5, Image.FromFile(Path.Combine(tilesPath, $"{baseName}_Runner.png")));
_tiles.Add(i * 10 + 6, Image.FromFile(Path.Combine(tilesPath, $"{baseName}_Tower.png")));
{ 06, 02, 05, 03, 04, 05, 02, 06 },
{ 01, 01, 01, 01, 01, 01, 01, 01 },
{ 00, 00, 00, 00, 00, 00, 00, 00 },
{ 00, 00, 00, 00, 00, 00, 00, 00 },
{ 00, 00, 00, 00, 00, 00, 00, 00 },
{ 00, 00, 00, 00, 00, 00, 00, 00 },
{ 11, 11, 11, 11, 11, 11, 11, 11 },
{ 16, 12, 15, 14, 13, 15, 12, 16 },
private void pbPlayground_Paint(object sender, PaintEventArgs e)
for (var y = 0; y < PlaygroundSize; ++y)
for (var x = 0; x < PlaygroundSize; ++x)
var tileRectangle = new Rectangle(x * 64, y * 64, 64, 64);
var isXEven = x % 2 == 0;
var isYEven = y % 2 == 0;
e.Graphics.FillRectangle(isXEven ? isYEven ? Brushes.Black : Brushes.White : isYEven ? Brushes.White : Brushes.Black, tileRectangle);
e.Graphics.DrawRectangle(Pens.Black, tileRectangle);
var tileValue = _playground[y, x];
if (_tiles.TryGetValue(tileValue, out tile))
e.Graphics.DrawImage(tile, new Point(x * 64, y * 64));