public GridWorld(Grid grid, Cell[,] cells, int cellHeight, int cellWidth)
        {
            ROWS = cells.GetLength(0);
            COLUMNS = cells.GetLength(1);
            this.cells = cells;

            // Build the cells
            for (int i = 0; i < ROWS; i++)
            {
                for (int j = 0; j < COLUMNS; j++)
                {
                    // Check if this is an agent/reward
                    if (this.cells[i, j].IsAgentStartingCell())
                    {
                        this.agentStartingPosition = new int[2];
                        this.agentStartingPosition[0] = i;
                        this.agentStartingPosition[1] = j;
                    }

                    if (this.cells[i, j].IsRewardCell())
                    {
                        this.rewardPosition = new int[2];
                        this.rewardPosition[0] = i;
                        this.rewardPosition[1] = j;
                    }

                    // Make a rectangle for the grid
                    Rectangle rectangle = new Rectangle();

                    rectangle.Name = "cell" + i + j;

                    rectangle.Height = cellHeight;
                    rectangle.Width = cellWidth;

                    rectangle.VerticalAlignment = VerticalAlignment.Top;
                    rectangle.HorizontalAlignment = HorizontalAlignment.Left;

                    rectangle.Margin = new Thickness(j * cellWidth, i * cellHeight, 0, 0);

                    rectangle.Stroke = CELL_STROKE_COLOR;

                    if (this.cells[i, j].IsObstacle())
                    {
                        rectangle.Fill = OBSTACLE_CELL_BACKGROUND_COLOR;
                    }
                    else
                    {
                        rectangle.Fill = UNOCCUPIED_CELL_BACKGROUND_COLOR;
                    }

                    this.cells[i, j].SetRectangle(rectangle);

                    grid.Children.Add(this.cells[i, j].GetRectangle());
                }
            }
        }
        public static void Save(Cell[,] cells)
        {
            // Verify the directory exists
            if (!Directory.Exists(EXPORT_DIRECTORY))
            {
                Directory.CreateDirectory(EXPORT_DIRECTORY);
            }

            // Save a CSV file for f, g, and h
            using (StreamWriter file = new StreamWriter(EXPORT_DIRECTORY + @"\f.csv"))
            {
                for (int rowIndex = 0; rowIndex < cells.GetLength(0); rowIndex++)
                {
                    for (int columnIndex = 0; columnIndex < cells.GetLength(1); columnIndex++)
                    {
                        file.Write(cells[rowIndex, columnIndex].GetFScore());

                        if (columnIndex == cells.GetLength(1) - 1)
                        {
                            file.WriteLine();
                        }
                        else
                        {
                            file.Write(",");
                        }
                    }
                }
            }

            using (StreamWriter file = new StreamWriter(EXPORT_DIRECTORY + @"\g.csv"))
            {
                for (int rowIndex = 0; rowIndex < cells.GetLength(0); rowIndex++)
                {
                    for (int columnIndex = 0; columnIndex < cells.GetLength(1); columnIndex++)
                    {
                        file.Write(cells[rowIndex, columnIndex].GetGScore());

                        if (columnIndex == cells.GetLength(1) - 1)
                        {
                            file.WriteLine();
                        }
                        else
                        {
                            file.Write(",");
                        }
                    }
                }
            }

            using (StreamWriter file = new StreamWriter(EXPORT_DIRECTORY + @"\h.csv"))
            {
                for (int rowIndex = 0; rowIndex < cells.GetLength(0); rowIndex++)
                {
                    for (int columnIndex = 0; columnIndex < cells.GetLength(1); columnIndex++)
                    {
                        file.Write(cells[rowIndex, columnIndex].GetHScore());

                        if (columnIndex == cells.GetLength(1) - 1)
                        {
                            file.WriteLine();
                        }
                        else
                        {
                            file.Write(",");
                        }
                    }
                }
            }
        }