Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String crittmp = data.remove(0);
- Double criticalValue = Double.parseDouble(crittmp);
- criticalValue /= (tab.length*tab.length);
- System.err.println("CRITICAL VALUE = " + criticalValue);
- List<Double> steps = new ArrayList<>();
- for(String s : data)
- steps.add(Double.parseDouble(s.trim()));
- int TIME = steps.size();
- transformTab();
- for(int step = 0; step < TIME; step++){
- double pula = steps.remove(0);
- double ro = pula / (tab.length*tab.length);
- boolean[][] border = new boolean[tab.length][tab.length];
- for(int i=0; i <tab.length; i++){
- for(int j=0; j<tab.length; j++){
- border[i][j] = isBorder(i, j);
- }
- }
- for(int i = 0; i < tab.length; i++){
- for(int j = 0; j < tab.length; j++){
- if(border[i][j]){
- newTab[i][j].points += 0.8 * ro;
- pula -= 0.8 * ro;
- } else {
- newTab[i][j].points += 0.2 * ro;
- pula -= 0.2 * ro;
- }
- if(newTab[i][j].points >= criticalValue){
- game.doExplode(newTab, i, j);
- System.out.println("reach critical value!");
- if(!AFTER)AFTER = true;
- }
- }
- }
- Random rand = new Random();
- while(pula > 0){
- int i = rand.nextInt(tab.length);
- int j = rand.nextInt(tab.length);
- if(border[i][j]){
- newTab[i][j].points += 0.8 * ro;
- pula -= 0.8 * ro;
- } else {
- newTab[i][j].points += 0.2 * ro;
- pula -= 0.2 * ro;
- }
- if(newTab[i][j].points >= criticalValue){
- game.doExplode(newTab, i, j);
- System.out.println("reach critical value!");
- if(!AFTER)AFTER = true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement