all repos — WarBot2020 @ c4ea0c66f375a763d21fceff6adbae190ba7ecbe

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

siciliaguerrabot2020/StatComune.java (view raw)

 1/*
 2 * To change this license header, choose License Headers in Project Properties.
 3 * To change this template file, choose Tools | Templates
 4 * and open the template in the editor.
 5 */
 6package siciliaguerrabot2020;
 7
 8/**
 9 *
10 * @author Marco
11 */
12public class StatComune implements Comparable<StatComune> {
13    private final String nome;
14    private int n_vincite;
15
16    public StatComune(String nome) {
17        this.nome = nome;
18        this.n_vincite = 0;
19    }
20
21    public String getNome() {
22        return nome;
23    }
24
25    public double getWinrate(int n_partite) {
26        return (100 * (double)n_vincite / (double)n_partite);
27    }
28    
29    public void winWar(){
30        n_vincite++;
31    }
32
33    @Override
34    public int compareTo(StatComune thi) {
35        return (thi.n_vincite - this.n_vincite);
36    }
37}