net.bluebones.tictactoe
Class TicTacToe
java.lang.Object
net.bluebones.tictactoe.TicTacToe
public class TicTacToe
- extends Object
Mother class for the net.bluebones.tictactoe
package.
This class is executable and expects as two commandline arguments
the names of the classes of the two players. The class "Human" is
included for human players, as are several AI players.
- Version:
- 1.1
- Author:
- Thomas David Baker, bakert+tictactoe@gmail.com
Field Summary |
static byte |
CROSSES
int representing crosses (x) |
static byte |
EMPTY
byte representing empty. |
static byte |
NOUGHTS
int representing noughts (o) |
Method Summary |
static void |
main(String[] args)
Controlling method of the TicTacToe executable. |
static byte |
reverse(byte i)
Takes supplied integer and returns its "reverse", that is the number of
the opposing player. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EMPTY
public static final byte EMPTY
byte
representing empty.
- See Also:
- Constant Field Values
NOUGHTS
public static final byte NOUGHTS
int
representing noughts (o)
- See Also:
- Constant Field Values
CROSSES
public static final byte CROSSES
int
representing crosses (x)
- See Also:
- Constant Field Values
TicTacToe
public TicTacToe()
main
public static void main(String[] args)
- Controlling method of the
TicTacToe
executable. Begins
a game of tic-tac-toe. Expects class names of the players as two
commandline arguments.
- Parameters:
args
- String[]
commandline arguments. This
should be the class names of the players. If the
players are in the net.blubones.tictactoe
package the qualifier can be omitted, otherwise the full
class names are required.
reverse
public static byte reverse(byte i)
- Takes supplied integer and returns its "reverse", that is the number of
the opposing player. That is,
TicTacToe.reverse(TicTacToe.NOUGHTS)
returns
TicTacToe.CROSSES
and vice versa. Any other inputs are
illegal and will throw an exception.
- Parameters:
i
- int
to "reverse".
- Returns:
int
of reversed i
.