package org.roshambo.example;

/**
 * Import the package so you can use the match class and run different AIs
 * here in your main method.
 */
import org.roshambo.*;

/**
 * Importing example AIs
 */
import org.roshambo.example.competitors.DumbAI;
import org.roshambo.example.competitors.RandomAI;

public class Main {
    public static void main(String[] args) {
        /**
         * Instantiate competitors
         */
        Competitor player1 = new DumbAI();
        Competitor player2 = new RandomAI();

        /**
         * Setup a new match and pass in the competitors and the number of rounds
         */
        Match match = new Match(player1, player2, 10);

        /**
         * This is kinda convenience method. There's also another method "fightNextRound()"
         * where you can iterate through rounds one by one.
         *
         * IMPORTANT: After each round, the match instance will send feedback to the both
         * competitors so they can adjust their strategy based on previous actions.
         */
        match.fightUntilFinish();

        /**
         * Output helper method. If you want the results table as a hash just call "match.getResults()".
         */
        Helpers.printResults(match);

        /**
         * "match.getResults" will return a hash map that looks like this HashMap<Integer,HashMap<String, String>>
         *
         * or to say in JSON, it would look something like this:
         *
         * {
         *   1: {"player_1": "ROCK",  "player_2": "PAPER", "WINNER": "player_2"},
         *   2: {"player_1": "PAPER", "player_2": "PAPER", "WINNER": "Tie"},
         *   3: {"player_1": "PAPER", "player_2": "SCISSORS", "WINNER": "player_2"},
         * }
         */
    }
}

@@ -292,16 +292,65 @@
 domAI;%0A%0A
+import java.util.HashMap;%0Aimport java.util.Map;%0A%0A
 public c
@@ -1107,16 +1107,18 @@
 ilFinish
+ed
 ();%0A%0A   
@@ -1255,16 +1255,8 @@
     
-Helpers.
 prin
@@ -1269,16 +1269,172 @@
 ts(match
+);%0A    %7D%0A%0A    public static void printResults(Match match) %7B%0A        Competitor player1 = match.getPlayer1();%0A        Competitor player2 = match.getPlayer2(
 );%0A%0A    
@@ -1913,16 +1913,16 @@
     * %7D%0A
-
         
@@ -1921,20 +1921,855 @@
          */%0A
+        HashMap%3CInteger,HashMap%3CString, String%3E%3E results = match.getResults();%0A        HashMap%3CString, Integer%3E totals = match.getTotals();%0A%0A        System.out.format(%22Round,%25s,%25s,Winner%5Cn%22, player1.name(), player2.name());%0A%0A        for (Map.Entry%3CInteger, HashMap%3CString, String%3E%3E entry : results.entrySet()) %7B%0A            Integer round   = entry.getKey();%0A            String  weapon1 = entry.getValue().get(player1.name());%0A            String  weapon2 = entry.getValue().get(player2.name());%0A            String  winner  = entry.getValue().get(%22WINNER%22);%0A%0A            System.out.format(%22%25d,%25s,%25s,%25s%5Cn%22, round, weapon1, weapon2, winner);%0A        %7D%0A%0A        System.out.format(%22%5Cn%25s: %25s,%25s: %25s,Ties: %25s%5Cn%22,%0A            player1.name(), totals.get(player1.name()), player2.name(), totals.get(player2.name()), totals.get(%22Ties%22)%0A        );%0A
     %7D%0A%7D%0A

change fight method name