/*
 * Code used in the "Software Engineering" course.
 *
 * Copyright 2017 by Claudio Cusano (claudio.cusano@unipv.it)
 * Dept of Electrical, Computer and Biomedical Engineering,
 * University of Pavia.
 */
package goldrush;

import java.util.Random;

/**
 *
 * @author cl426792
 */
public class FumagalliGiulia extends GoldDigger {
    int place, days, diggers;
    Random randomGenerator;
    
    FumagalliGiulia(){
        randomGenerator = new Random();
        days = 0;
    }
    
    @Override
    public void dailyOutcome(int revenue, int[] distances, int[] diggers) { 
        this.diggers = diggers[place];
        System.out.println(place + " - " + revenue + " - " + diggers[place] + " - " + this.diggers);
    }
    
    @Override
    public int chooseDiggingSite(int[] distances){
        int r;
        if(days > 0){
            if(diggers > 1){
                r = randomGenerator.nextInt(2);
                if(place != r){
                    place = r;
                }
            }
        } else {
            place = 0;
        }
        
        days++;
        return place;
    }
}

@@ -354,20 +354,43 @@
  diggers
+%5B%5D
 ;%0A  
+ // int diggers;%0A  //
   Random
@@ -435,24 +435,26 @@
 ulia()%7B%0A    
+//
     randomGe
@@ -631,116 +631,8 @@
 gers
-%5Bplace%5D;%0A        System.out.println(place + %22 - %22 + revenue + %22 - %22 + diggers%5Bplace%5D + %22 - %22 + this.diggers)
 ;%0A  
@@ -709,23 +709,8 @@
 s)%7B%0A
-        int r;%0A
     
@@ -727,24 +727,26 @@
 s %3E 0)%7B%0A    
+//
         if(d
@@ -758,24 +758,26 @@
 s %3E 1)%7B%0A    
+//
             
@@ -776,17 +776,21 @@
         
-r
+place
  = rando
@@ -812,28 +812,36 @@
 Int(
-2
+3
 );%0A    
+//
     
+    %7D%0A
         
 if(p
@@ -840,21 +840,93 @@
     
-if(place != r
+    for(int i = distances.length - 1; i %3E= 0 ; i --)%7B%0A                if(diggers%5Bi%5D%3C2
 )%7B%0A 
@@ -952,17 +952,17 @@
 place = 
-r
+i
 ;%0A      

versione 2