/** Map containing the properties of the current node. */
private final Map<String, ArrayList<String>> m_props = new TreeMap<String, ArrayList<String>> ();
/** Apply some fixes for broken SGF files. */
private void applyFixes () {
Node root = m_tree.getRoot ();
GameInfo info = m_tree.getGameInfo (root);
if (root.hasSetup () && root.getPlayer () == null)
{
if (info.getHandicap () > 0)
{
root.setPlayer (WHITE);
}
else
{
boolean hasBlackChildMoves = false;
boolean hasWhiteChildMoves = false;
for (int i = 0; i < root.getNumberChildren (); ++i)
{
Move move = root.getChild (i).getMove ();
if (move == null)
continue;
if (move.getColor () == BLACK)
hasBlackChildMoves = true;
if (move.getColor () == WHITE)
hasWhiteChildMoves = true;
}
if (hasBlackChildMoves && !hasWhiteChildMoves)
root.setPlayer (BLACK);
if (hasWhiteChildMoves && !hasBlackChildMoves)
root.setPlayer (WHITE);
}
}
}