AfterKraft / BlackJack

BlackJack Program for our Group Project
0 stars 0 forks source link

I'm working on GameMaker and BlackJackTable to achieve a smooth Game setup #16

Open gabizou opened 11 years ago

gabizou commented 11 years ago

As title says, so far I've got the GameMaker to do thusly:

    public void setupGame(GameFactory gameFactory) {

        //Sets up Dealer and Deck
        Dealer dealer = new Dealer();

        Scanner input = new Scanner(System.in);

        System.out.println("How many players will be playing?");
        numOfPlayers= input.nextInt();
        addPlayers(numOfPlayers);

        gameTable = gameFactory.createTable(dealer, this.users);
        game = gameFactory.createGame();
        if(!gameTable.isSetUp) {
            gameTable.setupTable();
        }

    }

What's changed so far is just the idea that GameTable will now set up the Users in the list with bets. The check for whether a user is betting more than their balance is already set up as such in BlackJackGameTable:

    public void setupTable() {
        for(User user : users) {
            Scanner bet = new Scanner(System.in);
            System.out.print(user.userName+", how much would you like to bet?");

            int betAmmount=bet.nextInt();
            do{
                System.out.println(user.userName+", you can't bet more than you have!");
                System.out.println(user.userName+", for reference, you have "+user.balance);
                betAmmount= bet.nextInt();
            } while(betAmmount>user.balance);
            user.bet(betAmmount);
        }
        super.isSetUp = true;
    }
gabizou commented 11 years ago

Any ideas for what may need to be added to the BlackJackGameTable.setupTable() method?

FYI, I started looking into resource management and Generics, bringing me to start using super.isSetUp versus creating class specific variables for classes extending a Generic class (in this case BJGT extending GT).

gabizou commented 11 years ago

Pushed the these changes in e62145ceb36c8a5e8af8c7989db1bb332fac2d68

For future reference, I'll be putting in //TODO GUI element here! wherever I see in code that the GUIManager should be listening or doing something to the main JFrame`