mport java.util.*;
public class cheeseboard{

static Random r = new Random();
static int max=8;
static int [] queen =new int[max];
static int [][]cost = new int [max][max];
static int [][] arr=new int[max][max];
static int [][] n = new int[max][max];
public static int [] fullfilledarray()
{
	int [] tmp = new int[max];
	int k=0;
	int l=0;
	for(int i=0;i<max;i++){
		k=r.nextInt(max);
		l=r.nextInt(max);
		queen[k] = l;
		System.out.println(" result fullfilledarray function value : "+queen[k]);
	}	
	//for(int j=0;j<queen.length;j++){
	 //System.out.println("kk"+ k +queen[j]);
	//}
	
	/*System.out.println("----");
	//System.out.println(""+queen[k]);
	
	for(int s=0;s<queen.length;s++){
		tmp[s]=queen[k];
		System.out.println(""+queen[k]);
	}*/
	
	return queen;
	
}
public static void cost()
{
	   // int [] p = fullfilledarray();
		for(int i=0;i<max;i++){
			System.out.print("result cost function value : "+queen[i] + "
");
		}
				//cost[i][fullfilledarray()] = fullfilledarray();
				//System.out.println(""+p);
				//cost[i][p] = fullfilledarray();
			//	System.out.println(" i " + i + " p " + p + " " +cost[i][p]);

				  /*      for (int k = 0; k < max; k++) {
				        	if(fullfilledarray() == cost[k][max-1]){
				        		cost[i][k]++;
				        		//System.out.println("1st"+i + ""+k + cost[i][k] +"
");
				        		
				        	}
				        	
				        	
				            //if (cost[i][p] == cost[i][max])// same column
				            if ((queen[i] - cost[max-1][i]) == (max - i)){ // same major diagonal
				            	cost[i][k]++;
				            	//System.out.println("2nd"+i + ""+k + cost[i][k]);
				            //if ((q[n] - q[i]) == (n - i))   // same minor diagonal
				        }
				            if ((queen[max-1] - cost[i][max-1]) == (i-max)){
				            	cost[i][k]++;
				            	//System.out.println("rgwrg");
				            	//System.out.println("3nd"+i + ""+k + cost[i][k]);
				            	
				            }
				        
				    }
		
		}
		int [][] tmp = new int [max][max];
		for(int i=0;i<tmp.length;i++){
			for(int j=0;j<tmp.length;j++){
				tmp[i][j] = cost[i][j];
				//System.out.println("tmp"+ tmp[i][j]);
			}
		}*/
		//int [][] tmp = new int [max][max];
		//return tmp;
}

	
public static void main(String [] args)
{
	
	//System.out.println(""+fullfilledarray().toString());
	fullfilledarray();
	cost();
}
}

result fullfilledarray function value : 6
 result fullfilledarray function value : 1
 result fullfilledarray function value : 3
 result fullfilledarray function value : 7
 result fullfilledarray function value : 2
 result fullfilledarray function value : 7
 result fullfilledarray function value : 1
 result fullfilledarray function value : 2
result cost function value : 2
result cost function value : 1
result cost function value : 0
result cost function value : 6
result cost function value : 3
result cost function value : 1
result cost function value : 2
result cost function value : 7

Add a code snippet to your website: www.paste.org