de.tfhberlin.panitz.vier
Interface VierLogik


public interface VierLogik


Method Summary
 boolean fourWins()
          Tests if a player has won.
 int setChip(int column, byte colour)
          Sets a token of a certain player into a column of the board.
 java.lang.String toString()
          Gives a String represntation of the complete board.
 

Method Detail

setChip

public int setChip(int column,
                   byte colour)
Sets a token of a certain player into a column of the board.

Parameters:
column - The column where to set the token. It is in the range 1<=column<=Constants.COLUMNS.
colour - One of the colour constants: Constants.PLAYERONE and Constants.PLAYERTWO.
Returns:
The row in which the token lands. -1 if the column is full.

fourWins

public boolean fourWins()
Tests if a player has won.

Returns:
true if one of the players has won.

toString

public java.lang.String toString()
Gives a String represntation of the complete board. It could be some representation like:
  | | | | | | | |
 ---------------
 | | | | | | | |
 ---------------
 | | | |x|x| | |
 ---------------
 | | | |o|o| | |
 ---------------
 | | | |x|o| | |
 ---------------
 | | |x|o|o|x| |
 ---------------

Overrides:
toString in class java.lang.Object
Returns:
A String, which has all information for the token on the board.