<commit_before>package gol;

import java.io.IOException;

/**
 * This class presents the classical simulation Game of Life using functions. Some functionalities must be complete. 
 * 
 * See FIXME comments to implement the missing functionality.
 * 
 * @see http://en.wikipedia.org/wiki/Conway's_Game_of_Life
 * Teacher:
 * @author chema
 * Students:
 * @author <NAME> 
 * @author <NAME> 
 * 
 *The code is published in a public repository. 
 *https://github.com/Rodriwp/GameOfLife
 */
public class SimpleGameOfLifeToComplete {

	private static final int NGENERATIONS = 100;
	private static final int SIZE = 20;


	public static void main(String []args) throws IOException, InterruptedException{
		boolean [][]board = new boolean[SIZE][SIZE];
		boolean [][] newBoard = new boolean[SIZE][SIZE];
		int countLiveNeighbours=0;
		int totalAlive = 0;
		for(int i = 0;i<board.length;i++){
			for (int j= 0; j<board[0].length;j++){
				board[i][j]=Math.random()>0.5;
				totalAlive+=(board[i][j]?1:0);
			}
		}
		//board = demoPattern();

		for(int generation=0;generation<NGENERATIONS;generation++){
			//Evolution
			System.out.println("Generation: "+generation+" total alive: "+totalAlive);
			show(board);
			totalAlive = 0;
			newBoard= new boolean[SIZE][SIZE];
			for(int i = 0;i<board.length;i++){
				for (int j= 0; j<board[0].length;j++){
					
					//FIXME: Implement this function.

					countLiveNeighbours=countLiveNeighbours(board,i,j);
                    //System.out.println("The cell have this value: "+i+","+j+": "+countLiveNeighbours);//For debugging only 
					
					//FIXME: Check these conditions and assign new values.
					
					
                   if(board[i][j]){
                	//Any live cell with fewer than two live neighbours dies, as if caused by under-population.
   					//Any live cell with two or three live neighbours lives on to the next generation.
   					//Any live cell with more than three live neighbours dies, as if by overcrowding. 
                   }else{
                	 if(countLiveNeighbours == 3){//Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.
                		 newBoard[i][j] = true;
                	 }else{
                		 newBoard[i][j] = false; 
                	 }
                   }
			
					
					totalAlive+=(newBoard[i][j]?1:0);
				}
			}//Updating board

			//Copy newBoard into board
			for(int i = 0;i<board.length;i++){
				for (int j= 0; j<board[0].length;j++){
					board[i][j] = newBoard[i][j];
				}<commit_msg>Second update on the same fucking thing<commit_after>package gol;

import java.io.IOException;

/**
 * This class presents the classical simulation Game of Life using functions. Some functionalities must be complete. 
 * 
 * See FIXME comments to implement the missing functionality.
 * 
 * @see http://en.wikipedia.org/wiki/Conway's_Game_of_Life
 * Teacher:
 * @author chema
 * Students:
 * @author <NAME> 
 * @author <NAME> 
 * 
 *The code is published in a public repository. 
 *https://github.com/Rodriwp/GameOfLife
 */
public class SimpleGameOfLifeToComplete {

	private static final int NGENERATIONS = 100;
	private static final int SIZE = 20;


	public static void main(String []args) throws IOException, InterruptedException{
		boolean [][]board = new boolean[SIZE][SIZE];
		boolean [][] newBoard = new boolean[SIZE][SIZE];
		int countLiveNeighbours=0;
		int totalAlive = 0;
		for(int i = 0;i<board.length;i++){
			for (int j= 0; j<board[0].length;j++){
				board[i][j]=Math.random()>0.5;
				totalAlive+=(board[i][j]?1:0);
			}
		}
		//board = demoPattern();

		for(int generation=0;generation<NGENERATIONS;generation++){
			//Evolution
			System.out.println("Generation: "+generation+" total alive: "+totalAlive);
			show(board);
			totalAlive = 0;
			newBoard= new boolean[SIZE][SIZE];
			for(int i = 0;i<board.length;i++){
				for (int j= 0; j<board[0].length;j++){
					
					//FIXME: Implement this function.

					countLiveNeighbours=countLiveNeighbours(board,i,j);
                    //System.out.println("The cell have this value: "+i+","+j+": "+countLiveNeighbours);//For debugging only 
					
					//FIXME: Check these conditions and assign new values.
					
					
                   if(board[i][j]){
                	//Any live cell with fewer than two live neighbours dies, as if caused by under-population.
                	 //Any live cell with more than three live neighbours dies, as if by overcrowding.
                	   if (countLiveNeighbours<2||countLiveNeighbours>3){
                		   newBoard[i][j]= false;
                	//Any live cell with two or three live neighbours lives on to the next generation.
                	   }else{
                		   newBoard[i][j]= true;
                	   }
   					 
                   }else{
                	 if(countLiveNeighbours == 3){//Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.
                		 newBoard[i][j] = true;
                	 }else{
                		 newBoard[i][j] = false; 
                	 }
                   }
			
					
					totalAlive+=(newBoard[i][j]?1:0);
				}
			}//Updating board

			//Copy newBoard into board
			for(int i = 0;i<board.length;i++){
				for (int j= 0; j<board[0].length;j++){
					board[i][j] = newBoard[i][j];
				}
{'fraction_non_alphanumeric': 0.12835428785888534, 'fraction_numerical': 0.009757928316757366, 'mean_word_length': 2.499671700590939, 'pattern_counts': {'":': 2, '<': 22, '<?xml version=': 0, '>': 10, 'https://': 2, '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': '2751777', 'n_tokens_mistral': 1908, 'n_tokens_neox': 1590, 'n_words': 461}