ru.ifmo.knim.main
Class MoveResult

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

public class MoveResult
extends java.lang.Object

Class represents move result

Author:
Anthony Yakovlev

Field Summary
 boolean isGameOver
          Is the game finished
 int nTaken
          The amount of stones that were taken
 int takenFrom
          Line from which the stones were taken
 int winner
          Winner index
static int WINNER_COMPUTER
          Computer is the winner
static int WINNER_NOBODY
          Nobody is the winner on current move
static int WINNER_PLAYER
          Player is the winner
 
Constructor Summary
MoveResult()
          Default constructor of class
 
Method Summary
static MoveResult getMoveResult(int[] move)
          Performs array to structure result conversion
 void setGameOver(boolean b)
          Say that the game is over or not
 void setWinner(int id)
          Set id of a winner
 void take(int takeFrom, int nTaken)
          Take stones
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isGameOver

public boolean isGameOver
Is the game finished


winner

public int winner
Winner index


takenFrom

public int takenFrom
Line from which the stones were taken


nTaken

public int nTaken
The amount of stones that were taken


WINNER_NOBODY

public static final int WINNER_NOBODY
Nobody is the winner on current move

See Also:
Constant Field Values

WINNER_COMPUTER

public static final int WINNER_COMPUTER
Computer is the winner

See Also:
Constant Field Values

WINNER_PLAYER

public static final int WINNER_PLAYER
Player is the winner

See Also:
Constant Field Values
Constructor Detail

MoveResult

public MoveResult()
Default constructor of class

Method Detail

setGameOver

public void setGameOver(boolean b)
Say that the game is over or not

Parameters:
b - - flag

setWinner

public void setWinner(int id)
Set id of a winner

Parameters:
id - - winner

take

public void take(int takeFrom,
                 int nTaken)
Take stones

Parameters:
takeFrom - - where to take
nTaken - - how much to take

getMoveResult

public static MoveResult getMoveResult(int[] move)
Performs array to structure result conversion

Parameters:
move - the array of amount of stones in lines
Returns:
the parsed structure of null if error