class Settler { public static final int FOOD_TO_GROW = 20; public static final int PROD_WARRIOR = 10; public static final int PROD_SETTLER = 40; public static final int TURNS_TO_BUILD = 10; public static final int MAX_TURNS = 200; public static void main(String[] args) { int[] Food = new int[2]; int[] Prod = new int[2]; int[] Trade = new int[2]; Food[0] = Integer.parseInt(args[0]); Prod[0] = Integer.parseInt(args[1]); Trade[0] = Integer.parseInt(args[2]); Food[1] = Integer.parseInt(args[3]); Prod[1] = Integer.parseInt(args[4]); Trade[1] = Integer.parseInt(args[5]); int[] food = new int[10000]; int[] prod = new int[10000]; int[] pop = new int[10000]; boolean[] hasWarrior = new boolean[10000]; int trade=0; int cities=1; int[] settlers = new int[TURNS_TO_BUILD]; for(int i=1; i<=MAX_TURNS; i++) { int createdSettlers = 0; for(int city=0; city=FOOD_TO_GROW && pop[city]==0) { food[city]=0; pop[city]++; } if (prod[city]>=PROD_WARRIOR && !hasWarrior[city]) { hasWarrior[city]=true; prod[city]=0; } if (prod[city]>=PROD_SETTLER && pop[city]>0) { pop[city]=0; prod[city]=0; createdSettlers++; } } cities+=settlers[TURNS_TO_BUILD-1]; for(int set = TURNS_TO_BUILD-1; set>0; set--) settlers[set]=settlers[set-1]; settlers[0]=createdSettlers; System.out.println("turn:"+i+" city:"+cities+" trade:"+trade); } } }