<commit_before>import java.util.*;
import java.io.*;

public class Grid
{
    public static final int DEFAULT_WIDTH = 100;
    public static final int DEFAULT_HEIGHT = 100;

    public Grid (String fileName, boolean debug)
    {
        this(DEFAULT_HEIGHT, DEFAULT_WIDTH, fileName, debug);
    }

    public Grid (int height, int width, String fileName, boolean debug)
    {
        _height = height;
        _width = width;
        _debug = debug;

        loadPlane(fileName);
    }

    /**
     * If a seat is empty (L) and there are no occupied seats adjacent to it, the seat becomes occupied.
     * If a seat is occupied (#) and four or more seats adjacent to it are also occupied, the seat becomes empty.
     * Otherwise, the seat's state does not change.
     */

    public void evolve ()
    {
        Cell[][] _nextPlane = new Cell[_height][_width];
        
        for (int i = 0; i < _height; i++)
        {
            for (int j = 0; j < _width; j++)
            {
                int adjacentSeats = 0;

                // ignore range checking and rely on exception!

                if (_debug)
                    System.out.println("Checking cell < "+i+", "+j+" > : "+_thePlane[i][j]);

                try
                {
                    if (adjacentSeat(i-1, j))
                        adjacentSeats++;
                }
                catch (IndexOutOfBoundsException ex)
                {
                }

                try
                {
                    if (adjacentSeat(i+1, j))
                        adjacentSeats++;
                }
                catch (IndexOutOfBoundsException ex)
                {
                }

                try
                {
                    if (adjacentSeat(i, j-1))
                        adjacentSeats++;
                }
                catch (IndexOutOfBoundsException ex)
                {<commit_msg>Update Grid.java<commit_after>import java.util.*;
import java.io.*;

public class Grid
{
    public static final int DEFAULT_WIDTH = 100;
    public static final int DEFAULT_HEIGHT = 100;

    public Grid (String fileName, boolean debug)
    {
        this(DEFAULT_HEIGHT, DEFAULT_WIDTH, fileName, debug);
    }

    public Grid (int height, int width, String fileName, boolean debug)
    {
        _height = height;
        _width = width;
        _debug = debug;

        loadPlane(fileName);
    }

    /**
     * If a seat is empty (L) and there are no occupied seats adjacent to it, the seat becomes occupied.
     * If a seat is occupied (#) and four or more seats adjacent to it are also occupied, the seat becomes empty.
     * Otherwise, the seat's state does not change.
     */

    public void evolve ()
    {
        Cell[][] _nextPlane = new Cell[_height][_width];
        
        for (int i = 0; i < _height; i++)
        {
            for (int j = 0; j < _width; j++)
            {
                int adjacentSeats = 0;

                // ignore range checking and rely on exception!

                if (_debug)
                    System.out.println("Checking cell < "+i+", "+j+" > : "+_thePlane[i][j]);

                /*
                 * 2,2
                 * 
                 * 1,2
                 * 3,2
                 * 2,1
                 * 2,3
                 * 
                 * 
                 * 1,3 2,3 3,3
                 * 1,2 2,2 3,2
                 * 1,1 2,1 3,1
                 * 
                 * -1,1 0,1 1,1
                 * -1,0 0,0 1,0
                 * -1,-1 0,-1 1,-1
                 */

                // first the diagonals

                try
                {
                    if (adjacentSeat(i-1, j+1))
                        adjacentSeats++;
                }
                catch (IndexOutOfBoundsException ex)
                {
                }

                try
                {
                    if (adjacentSeat(i+1, j+1))
                        adjacentSeats++;
                }
                catch (IndexOutOfBoundsException ex)
                {
                }

                try
                {
                    if (adjacentSeat(i-1, j-1))
                        adjacentSeats++;
                }
                catch (IndexOutOfBoundsException ex)
                {
                }

                try
                {
                    if (adjacentSeat(i+1, j-1))
                        adjacentSeats++;
                }
                catch (IndexOutOfBoundsException ex)
                {
                }

                // now the cross elements

                try
                {
                    if (adjacentSeat(i-1, j))
                        adjacentSeats++;
                }
                catch (IndexOutOfBoundsException ex)
                {
                }

                try
                {
                    if (adjacentSeat(i+1, j))
                        adjacentSeats++;
                }
                catch (IndexOutOfBoundsException ex)
                {
                }

                try
                {
                    if (adjacentSeat(i, j-1))
                        adjacentSeats++;
                }
                catch (IndexOutOfBoundsException ex)
                {
{'fraction_non_alphanumeric': 0.08655126498002663, 'fraction_numerical': 0.014837359710861708, 'mean_word_length': 0.9380759307040177, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, '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': '3201428', 'n_tokens_mistral': 1444, 'n_tokens_neox': 1297, 'n_words': 371}