models
Class Match

java.lang.Object
  extended by models.Game
      extended by models.Match

public class Match
extends Game

Author:
Sulake 2012 Match class that controls the game between two players

Constructor Summary
Match(com.sulake.habbo.gaming.api.domain.Player p1, com.sulake.habbo.gaming.api.domain.Player p2)
           
 
Method Summary
 void buyCut(int amount)
           
 void buyHalf(int amount)
           
 void checkWinner()
           
 void cutRange()
          Execute the Cut range and update the range
 int getCut()
           
 int getHalf()
           
 int getMaxRange()
           
 int getMinRange()
           
 Players getPlayer(java.lang.String aToken)
           
 Players getPlayer1()
           
 Players getPlayer2()
           
 int getPurse()
           
 int getTries()
           
 Players getWinner()
           
 void halfRange()
          Execute the Half range and update the range
 boolean inRange(int num)
           
 boolean myTurn(java.lang.String aToken)
           
 void setNumber(int number, java.lang.String aToken)
           
 java.lang.String whoIsFirst()
           
 java.lang.String whoIsFirstName()
           
 java.lang.String whoWins()
           
 
Methods inherited from class models.Game
addPlayers, addPlayers, getInstance, getMatchForPlayer, getSize, quitGame, relocateWinner, start_match, startConnection
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Match

public Match(com.sulake.habbo.gaming.api.domain.Player p1,
             com.sulake.habbo.gaming.api.domain.Player p2)
Method Detail

getMinRange

public int getMinRange()
Returns:
return the minimun value for the range

getMaxRange

public int getMaxRange()
Returns:
the maximum value for the range

getPlayer

public Players getPlayer(java.lang.String aToken)

getPlayer1

public Players getPlayer1()
Returns:
the player 1

getPlayer2

public Players getPlayer2()
Returns:
The player 2

whoIsFirst

public java.lang.String whoIsFirst()

whoIsFirstName

public java.lang.String whoIsFirstName()
Returns:
the name of the first player

whoWins

public java.lang.String whoWins()
Returns:
access token of the winner

setNumber

public void setNumber(int number,
                      java.lang.String aToken)
Parameters:
integer - number
String - access token set the number that a user introduce

getTries

public int getTries()
Returns:
the number of tries are left for player 2

myTurn

public boolean myTurn(java.lang.String aToken)

checkWinner

public void checkWinner()

getWinner

public Players getWinner()

buyHalf

public void buyHalf(int amount)
Parameters:
amount - of Half the user wants to buy

buyCut

public void buyCut(int amount)
Parameters:
amount - of Cut the user wants to buy

halfRange

public void halfRange()
Execute the Half range and update the range


cutRange

public void cutRange()
Execute the Cut range and update the range


inRange

public boolean inRange(int num)
Parameters:
integer - number, check if the intruced number is within the range

getCut

public int getCut()
Returns:
amount of cut the range left

getHalf

public int getHalf()
Parameters:
Amount - of half the range left

getPurse

public int getPurse()
Returns:
the amount of the Purse