private int decideNextBlockColor(ThreesBlock nowBlock,int whiteCount,int blueCount,int redCount,int maxNumber) {
        int nowNumber = -1;
        if(nowBlock != null){
            nowNumber = nowBlock.getNumber();
        }
        int[] weights = {5, 5, 5};    //weights for white, blue and red, default for equals.
        for(int i=0;i<3;i++){
            if(i!=nowNumber){
                weights[i] = weights[i] + 15;
            }
        }
        if(redCount==blueCount){
            
        }else if(blueCount > redCount){
            weights[2] = weights[2] + 15*(blueCount - redCount);
        }else{
            weights[1] = weights[1] + 15*(redCount - blueCount);
        }
//        System.out.println(weights[0]+" "+weights[1]+" "+weights[2]);
        
        int newNumber = 0;
        int random = ran.nextInt(weights[0]+weights[1]+weights[2]);
        if(random < weights[0]){
            //white
            int bigNumber = ran.nextInt(100);
            if(bigNumber<10){
                //generate a big number
                if(maxNumber/8 < 3){
                    newNumber = 3;
                }else{
                    newNumber = maxNumber/8;
                }
            }else{
                newNumber = 3;
            }
        }else if(random < weights[0]+weights[1]){
            //blue
            newNumber = 1;
        }else{
            //red
            newNumber = 2;
        }
        
        return newNumber;
    }