Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package player;
- import bet.Bet;
- public interface Player {
- /**
- * Returns the name of the player.
- */
- public String getName();
- /**
- * Returns the current balance of the player.
- */
- public int getBalance();
- /**
- * Makes a new bet for the next game according to the player's
- * strategy.
- */
- public Bet makeBet();
- /**
- * Adds the payout to the balance after winning a bet.
- */
- public void receivePayout(int payout);
- }
- package player;
- import bet.*;
- public class StraightPlayer implements Player {
- String player;
- int balance;
- int bet;
- int favourite;
- Bet win;
- public StraightPlayer(String name, int startBalance, int favourite) {
- this.player = name;
- this.balance = startBalance;
- this.favourite = favourite;
- }
- public int getFavourite() {
- return favourite;
- }
- public String getName() {
- // TODO Auto-generated method stub
- return player;
- }
- public int getFavourite() {
- return favourite;
- }
- public int getBalance() {
- // TODO Auto-generated method stub
- if (balance <= 0) {
- return 0;
- }
- else {
- return balance;
- }
- }
- public Bet makeBet() {
- // TODO Auto-generated method stub
- bet = 1;
- balance = balance - bet;
- return win; //incomplete
- }
- public void receivePayout(int payout) {
- // TODO Auto-generated method stub
- balance = balance + win.getPayout();
- }
- }
- //method outside (Straight)Player
- if (int x == player.getFavourite) {
- stuff }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement