<commit_before>﻿namespace Minesweeper.Logic
{
    using System;
    using Minesweeper.Logic.Enumerations;

    public class PlayingField
    {
        private readonly MineCell[,] field;

        internal PlayingField(int rows, int cols, int minesCount)
        {
            this.field = new MineCell[rows, cols];
            this.FillPlayingFieldWithMineCells(this.field);
            this.SetMines(this.field, minesCount);
            MineCalculator.CalculateFieldValues(this.field);
        }

        public MineCell[,] Field
        {
            get
            {
                return this.field;
            }
        }

        internal GameStatus OpenCell(int row, int column)
        {
            MineCell field = this.field[row, column];
            GameStatus status;

            if (field.Status == FieldStatus.IsAMine)
            {
                status = GameStatus.GameOver;
            }
            else if (field.Status == FieldStatus.Opened)
            {
                status = GameStatus.GameOn;
            }
            else
            {
                field.Value = MineCalculator.CountSurroundingMines(this.field, row, column);
                field.Status = FieldStatus.Opened;
                status = GameStatus.GameOn;
            }

            return status;
        }

        private void FillPlayingFieldWithMineCells(MineCell[,] emptyPlayingField)
        {
            int rows = emptyPlayingField.GetLength(0);
            int cols = emptyPlayingField.GetLength(1);
            MineCell[,] playingField = emptyPlayingField;
            MineCell mine = new MineCell();<commit_msg>Removed unnecessary calculation<commit_after>﻿namespace Minesweeper.Logic
{
    using System;
    using Minesweeper.Logic.Enumerations;

    public class PlayingField
    {
        private readonly MineCell[,] field;

        internal PlayingField(int rows, int cols, int minesCount)
        {
            this.field = new MineCell[rows, cols];
            this.FillPlayingFieldWithMineCells(this.field);
            this.SetMines(this.field, minesCount);
            MineCalculator.CalculateFieldValues(this.field);
        }

        public MineCell[,] Field
        {
            get
            {
                return this.field;
            }
        }

        internal GameStatus OpenCell(int row, int column)
        {
            MineCell field = this.field[row, column];
            GameStatus status;

            if (field.Status == FieldStatus.IsAMine)
            {
                status = GameStatus.GameOver;
            }
            else if (field.Status == FieldStatus.Opened)
            {
                status = GameStatus.GameOn;
            }
            else
            {
                field.Status = FieldStatus.Opened;
                status = GameStatus.GameOn;
            }

            return status;
        }

        private void FillPlayingFieldWithMineCells(MineCell[,] emptyPlayingField)
        {
            int rows = emptyPlayingField.GetLength(0);
            int cols = emptyPlayingField.GetLength(1);
            MineCell[,] playingField = emptyPlayingField;
            MineCell mine = new MineCell();
{'fraction_non_alphanumeric': 0.07890600440113171, 'fraction_numerical': 0.0012574662055957245, 'mean_word_length': 1.56406124093473, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3853414', 'n_tokens_mistral': 855, 'n_tokens_neox': 806, 'n_words': 167}