all repos — WarBot2020 @ 43b20020df619e21cbf2936bd01b4ee7e2ce84df

Bootleg version of "WorldWarBot 2020" done in Java and without a map.

Add files via upload
Bi-Rabittoh andronacomarco@gmail.com
Sat, 06 Apr 2019 02:46:28 +0200
commit

43b20020df619e21cbf2936bd01b4ee7e2ce84df

parent

ac82759004ccb039ce6892441b5427b496ff88e7

1 files changed, 6 insertions(+), 5 deletions(-)

jump to
M siciliaguerrabot2020/SiciliaGuerraBot2020.javasiciliaguerrabot2020/SiciliaGuerraBot2020.java

@@ -5,9 +5,10 @@ * and open the template in the editor.

*/ package siciliaguerrabot2020; +import siciliaguerrabot2020.Guerra.StatComune; import siciliaguerrabot2020.Guerra.Comune; import siciliaguerrabot2020.Guerra.Territorio; -import siciliaguerrabot2020.Guerra.Centroide; +import siciliaguerrabot2020.Guerra.Posizione; import java.io.BufferedReader; import java.io.File; import java.io.FileReader;

@@ -41,7 +42,7 @@ private boolean helpRequested;

public static void main(String[] args) { - //String[] debug_args = {"-m=50000", "-h"}; SiciliaGuerraBot2020 par = CommandLine.populateCommand(new SiciliaGuerraBot2020(), debug_args); + //String[] debug_args = {"-m=50000", "-v"}; SiciliaGuerraBot2020 par = CommandLine.populateCommand(new SiciliaGuerraBot2020(), debug_args); SiciliaGuerraBot2020 par = CommandLine.populateCommand(new SiciliaGuerraBot2020(), args); if(par.helpRequested){

@@ -63,7 +64,7 @@ reader = new BufferedReader(new FileReader(file));

String line = reader.readLine(); while (line != null){ st = new StringTokenizer(line); - comuni_unfiltered.add(new Comune(st.nextToken(), Integer.parseInt(st.nextToken()), new Centroide(Double.parseDouble(st.nextToken()), Double.parseDouble(st.nextToken())))); + comuni_unfiltered.add(new Comune(st.nextToken(), Integer.parseInt(st.nextToken()), new Posizione(Double.parseDouble(st.nextToken()), Double.parseDouble(st.nextToken())))); line = reader.readLine(); } } catch (IOException e){

@@ -95,7 +96,7 @@ private static Comune combatteteSchiavi(ArrayList<Comune> lista_comuni, boolean verbose){

Calendario calendario = new Calendario(new Data(0, 1, 2020)); ArrayList<Comune> lista = new ArrayList<>(); for(Comune c: lista_comuni){ - lista.add(new Comune(c.getNome(), c.getPop(), new Centroide(c.getPos().x, c.getPos().y))); + lista.add(new Comune(c.getNome(), c.getPop(), new Posizione(c.getPos().x, c.getPos().y))); } Comune attaccante; Territorio vittima;

@@ -151,7 +152,7 @@ public static ArrayList<Comune> riempiLista(ArrayList<Comune> comuni_unfiltered, int soglia_popolazione){

ArrayList<Comune> comuni = new ArrayList<>(); for(Comune c : comuni_unfiltered){ if(c.getPop() >= soglia_popolazione) - comuni.add(new Comune(c.getNome(), c.getPop(), new Centroide(c.getPos().x, c.getPos().y))); + comuni.add(new Comune(c.getNome(), c.getPop(), new Posizione(c.getPos().x, c.getPos().y))); } return comuni; }