package com.editev.chess.printer;

import com.editev.chess.GameHTML;
import com.editev.chess.Chess;


/** Prints the HTML body for a chess board. 
 *
 *  @see See the source here.
 */
public class BodyPrinter extends Printer {
    /** Prints a whole chess game. */
    public Printer gamePrinter = new GamePrinter();

    /** Prints the HTML body for a chess game.
     *  @param game the GameHTML with the board status and PrintStream for this board.
     */
    public void print( GameHTML game ) {
        // start the body of the HTML document.
        // set all the links depending on color (quick hack here).  	
    	if (game.isWhiteMove() != (game.target != Chess.NO_MOVE)) game.out.print("\n");
    	else                                                      game.out.print("\n");

    	gamePrinter.print( game );
    	game.out.print("\n");                                // finish the body and the file
    }
}