ru.ifmo.knim.main
Class GameInfo

java.lang.Object
  extended byru.ifmo.knim.main.GameInfo

public class GameInfo
extends java.lang.Object

Represents game info

Author:
Anthony Yakovlev

Field Summary
static int DIFFICULTY_EASY
          "Easy" level of difficulty
static int DIFFICULTY_HARD
          "Hard" level of difficulty
static int DIFFICULTY_MEDIUM
          "Medium" level of difficulty
static int DIFFICULTY_NONE
          No difficulty at all
 
Constructor Summary
GameInfo(int nLines)
          Creates a gameinfo object
GameInfo(int[] stones)
          non-default contructor
 
Method Summary
 int getBadMoveLeft()
          Returns the amount of phora moves left
 int getFishInLine(int lineIdx)
          Returns amount of fish in a line
 int getLineAmount()
          Returns the amount of lines with stones
 int[] getLines()
          Gets array of fish lines
 boolean isGameover()
          Detects whether the game is over or not
 void restartGame()
          Restarts game.
 void setBadMovesLeft(int badMovesLeft)
          Sets the amount of phora moves
 int setGetDifficulty(int difficulty)
          Very cool function -- analog of compareAndSet primitive
 void setStones(int[] stones)
          Set array of stones as rules for new game
 void takeStones(int lineIdx, int amount)
          Takes the given amount of stones from the given line
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DIFFICULTY_EASY

public static final int DIFFICULTY_EASY
"Easy" level of difficulty

See Also:
Constant Field Values

DIFFICULTY_MEDIUM

public static final int DIFFICULTY_MEDIUM
"Medium" level of difficulty

See Also:
Constant Field Values

DIFFICULTY_HARD

public static final int DIFFICULTY_HARD
"Hard" level of difficulty

See Also:
Constant Field Values

DIFFICULTY_NONE

public static final int DIFFICULTY_NONE
No difficulty at all

See Also:
Constant Field Values
Constructor Detail

GameInfo

public GameInfo(int nLines)
Creates a gameinfo object

Parameters:
nLines - - amount of lines in a game

GameInfo

public GameInfo(int[] stones)
non-default contructor

Parameters:
stones -
Method Detail

getLines

public final int[] getLines()
Gets array of fish lines

Returns:

setStones

public void setStones(int[] stones)
Set array of stones as rules for new game

Parameters:
stones -

restartGame

public void restartGame()
Restarts game.


setGetDifficulty

public final int setGetDifficulty(int difficulty)
Very cool function -- analog of compareAndSet primitive

Parameters:
difficulty -
Returns:

getLineAmount

public int getLineAmount()
Returns the amount of lines with stones

Returns:
value from description

getFishInLine

public int getFishInLine(int lineIdx)
Returns amount of fish in a line

Parameters:
lineIdx - - the line idx
Returns:
amount of stones

takeStones

public void takeStones(int lineIdx,
                       int amount)
Takes the given amount of stones from the given line

Parameters:
lineIdx - - the line idx
amount - - amount of stones to take

getBadMoveLeft

public int getBadMoveLeft()
Returns the amount of phora moves left

Returns:
the amount of phora moves

setBadMovesLeft

public void setBadMovesLeft(int badMovesLeft)
Sets the amount of phora moves

Parameters:
badMovesLeft - the amount of phora moves

isGameover

public boolean isGameover()
Detects whether the game is over or not

Returns:
true if the game is over