<commit_before>package elimGameEL;

public class Data {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}<commit_msg>time"2017-05-01 22:21:31"<commit_after>package elimGameEL;

import java.util.ArrayList;
import java.util.List;
import java.util.Arrays;



public class Data {
	
	//Եmain
	//######################################
	public static void main(String[] args) {
		long startTime=System.nanoTime();   //ȡʼʱ  //¼ʼʱ
		
		// TODO Auto-generated method stub
		Data data = new Data();
		
		data.initializeData(5);
		
		data.showData(data.argsData);

		System.out.println();
		data.showData(data.isAbleElim());
		
		long endTime=System.nanoTime(); //ȡʱ //¼ʱ
		System.out.println();
		System.out.println("ʱ䣺 "+(endTime-startTime)/1000000D+"ms"); 
	}
	//#######################################
	
	//****************************************
	private final int height = 10;
	private final int width = 8;
	private int[][] argsData = new int[height][width];
	
	
	

	
	//***************************************
	/**
	 * Եʱʾ
	 */
	public void showData(int[][] data){
		if(data!=null){
			System.out.println("##  0  1  2  3  4  5  6  7 ");
			for(int i =0 ; i<height ; i++){
			System.out.println(" "+(i)+" "+Arrays.toString(data[i]));
			}
		
		}else{
			System.out.println("null");
		}
		
	}
	
	
	//***************************************
	/**
	 * ʼ,Ҹÿλ1variety
	 * @param variety Ϊͼĸ
	 */
	public void initializeData(int variety){
		for(int i =0;i<width;i++){
			for(int j =0;j<height;j++){
				argsData[j][i]=(int)(Math.random()*variety+1);
			}
		}
		
	}
	
	
	/**
	 * жϵǰǷп,ûоͷnull,򷵻һ,иʾӦñԪ
	 * ʱԱ鵥Ըд
	 * @return һ,иʾӦñ;nullʾûпĵ
	 * 
	 */
	public int[][] isAbleElim(){
		int[][] argsData = new int[height][width];
		boolean ableElim = false;
		
		for(int i =0;i<width;i++){
			for(int j =0;j<height;j++){
				argsData[j][i]=this.argsData[j][i];
			}
		}
		for(int i =0;i<width;i++){
			for(int j =0;j<height;j++){
				{
					int count =1;
					int t =i-1;
					while(t>=0){
						if(this.argsData[j][i]==this.argsData[j][t]){
							count++;
							t--;
						}else{ break; }
						
					}
					t=i+1;
					while(t<width){
						if(this.argsData[j][i]==this.argsData[j][t]){
							count++;
							t++;
						}else{ break; }
						
					}
					
					{
						if(count>2){
							ableElim = true;
							argsData[j][i]=-this.argsData[j][i];
							int s =i-1;
							while(s>=0){
								if(this.argsData[j][i]==this.argsData[j][s]){
									argsData[j][s]=-this.argsData[j][i];
									s--;
								}else{ break; }
								
							}
							s=i+1;
							while(s<width){
								if(this.argsData[j][i]==this.argsData[j][s]){
									argsData[j][s]=-this.argsData[j][i];
									s++;
								}else{ break; }
								
							}
							
						}
					}
				
					
				}
				
				{
					int countj =1;
					int t =j-1;
					while(t>=0){
						if(this.argsData[j][i]==this.argsData[t][i]){
							countj++;
							t--;
						}else{ break; }
						
					}
					t=j+1;
					while(t<height){
						if(this.argsData[j][i]==this.argsData[t][i]){
							countj++;
							t++;
						}else{ break; }
						
					}
					
					{
						if(countj>2){
							ableElim = true;
							argsData[j][i]=-this.argsData[j][i];
							int s =j-1;
							while(s>=0){
								if(this.argsData[j][i]==this.argsData[s][i]){
									argsData[s][i]=-this.argsData[j][i];
									s--;
								}else{ break; }
								
							}
							s=j+1;
							while(s<height){
								if(this.argsData[j][i]==this.argsData[s][i]){
									argsData[s][i]=-this.argsData[j][i];
									s++;
								}else{ break; }
								
							}
							
						}
						
					}
				
					
				}
//				List<Integer> nearij = this.getNear(i, j);
//				for(int ij : nearij){
//					if(argsData[j][i]==argsData[ij%100][ij/100]){
//						if(j==ij%100){
//							while(t<){
//								
//							}
//						}else{}
//					}
//				}
			}
		}	
		
		
		if(ableElim){
		
			return argsData;
		
		}else{
			return null;
		}
		
		
	}
	
	/**
	 * ݵĵõֵ һlist,listÿֵİλΪ,ʮλ͸λΪ
	 * ʽΪ()()
	 * 70979
	 * @param i Ϊ,
	 * @param j Ϊ,
	 * @return һlist,ֳ
	 */
	public List<Integer> getNear(int i,int j){
		List<Integer> ret=new ArrayList<Integer>();
		if((i-1)>0)		{ret.add((i-1)*100+j);}
		if((i+1)<width)	{ret.add((i+1)*100+j);}
		if((j-1)>0)		{ret.add(i*100+(j-1));}
		if((j+1)<height){ret.add(i*100+(j+1));}

		return  ret;
}
}
{'fraction_non_alphanumeric': 0.24338503649635038, 'fraction_numerical': 0.02144160583941606, 'mean_word_length': 2.1077250177179305, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 15, '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': '3067499', 'n_tokens_mistral': 2515, 'n_tokens_neox': 1793, 'n_words': 261}