debug
Class FenUtility

java.lang.Object
  extended by debug.FenUtility

public class FenUtility
extends java.lang.Object

This class is the FEN Utility used by the debug class. Methods here convert a compressed FEN String into a Position object and visa versa. Note: FEN = Forsynth-Edwards Notation.

Author:
Andy Huang, Simon Suo

Constructor Summary
FenUtility()
           
 
Method Summary
static void displayBoard(java.lang.String fen)
          Prints to the console a text based graphical representation of the position object with the given FEN string.
static Position loadFEN(java.lang.String fen)
          Converts a FEN representation of a Position object into a Position object.
static java.lang.String read(java.lang.String file)
          Reads 1 line of a string from a file.
static java.lang.String saveFEN(Position p)
          Converts a Position object into a FEN String that represents the object.
static java.lang.String saveFENPlus(boolean ai_colour, java.lang.String moveList)
          Saves the FENPlus string, which consists of a sequence of moves, the colour that the AI is playing in as well as the current moveNumber.
static void write(java.lang.String file, java.lang.String text)
          Writes a string to a file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FenUtility

public FenUtility()
Method Detail

loadFEN

public static Position loadFEN(java.lang.String fen)
Converts a FEN representation of a Position object into a Position object.

Parameters:
fen - The FEN Representation of a Position Object.
Returns:
A Position object as described by the FEN string.

saveFEN

public static java.lang.String saveFEN(Position p)
Converts a Position object into a FEN String that represents the object. Note: since the full-move clock is not used in the Position object, the full-move clock will not be stored in the FEN string.

Parameters:
p - The position to convert into FEN string.
Returns:
A string representing the FEN version of the board.

saveFENPlus

public static java.lang.String saveFENPlus(boolean ai_colour,
                                           java.lang.String moveList)
Saves the FENPlus string, which consists of a sequence of moves, the colour that the AI is playing in as well as the current moveNumber. The output uses comma separated values.

Parameters:
ai_colour - The colour that Myriad XSN played during the game.
moveList - The list of moves made during the course of the game.
Returns:
A FENPlus string as described above.

displayBoard

public static void displayBoard(java.lang.String fen)
Prints to the console a text based graphical representation of the position object with the given FEN string.

Parameters:
fen - The FEN string representing the Position object.

write

public static void write(java.lang.String file,
                         java.lang.String text)
                  throws java.io.IOException
Writes a string to a file.

Parameters:
file - The name of the file to write to.
text - The text to write to the file.
Throws:
java.io.IOException - If any file errors occur, e.g. file unwritable.

read

public static java.lang.String read(java.lang.String file)
                             throws java.io.IOException
Reads 1 line of a string from a file.

Parameters:
file - The name of the file to read from.
Throws:
java.io.IOException - If any file errors occur, e.g. file unreadable.