private void RenderLoop()
        {
            lock (canvas)
            {
                for (int i = 0; i < game.height; i++)
                {
                    for (int j = 0; j < game.width; j++)
                    {
                        if (game.GetCellValue(j, i) == 1)
                        {
                            canvas.SetPixel(1 + j, 1 + i, colors["white"]);
                        }
                        else
                        {
                            if (game.GetLastCellValue(j, i) == 1)
                            {
                                canvas.SetPixel(1 + j, 1 + i, colors["gray 48"]);
                            }
                            else
                            {
                                if ((i + j) % 2 == 0)
                                {
                                    canvas.SetPixel(1 + j, 1 + i, colors["gray 32"]);
                                }
                                else
                                {
                                    canvas.SetPixel(1 + j, 1 + i, colors["gray 24"]);
                                }
                            }
                        }
                    }
                }
            }

            Invoke((MethodInvoker)(() => { Refresh(); }));
        }