/*
 * @topic T00805 Dice Roller App Sample
 * @brief Main driver
 */
package diceroll;

public class Main {

    public static void main(String[] args) {
        int dieSideCount = 6;
        DicePair pair = new DicePair( dieSideCount );
        int total = pair.roll();
        System.out.println( "total " + total );

        Menu menu = new Menu();
        menu.attach( "1 Change Side Count" );
        menu.attach( "2 Roll" );
        menu.attach( "3 Quit" );

        int choice = Menu.CHOICE_UNKNOWN;
        while ( choice != Menu.CHOICE_QUIT ) {
            choice = menu.getUserChoice();
            switch( choice ) {
                case Menu.CHOICE_SIDE_COUNT:
                    // TODO -- ask for new dieSideCount
                    // For debugging puposes, double the sides of the dice:
                    dieSideCount = dieSideCount * 2; //DEBUG
                    pair = new DicePair( dieSideCount );
                    break;

                case Menu.CHOICE_ROLL:
                    total = pair.roll();
                    System.out.println( "total " + total );
                    break;

                case Menu.CHOICE_QUIT:
                    System.out.println( "Bye!" );
                    break;

                default:
                    // TODO -- warn about internal application logic error
                    break;
            }//switch
        }//while


    }//main

}//class Main