package com.editev.chess.printer;

import com.editev.chess.GameHTML;
import com.editev.util.Lists;

/** Prints an entire chess game!
 *
 *  @see See the source here.
 */
public class GamePrinter extends Printer {
    /** Print the status of Black. */
    public Printer blackStatus    = new StatusPrinter( false );

    /** Print the status of White. */
    public Printer whiteStatus    = new StatusPrinter( true );

    /** Print the entire board. */
    public Printer boardPrinter   = new BoardPrinter();

    /** Print the move history. */
    public Printer historyPrinter = new HistoryPrinter();
    
    /** Print a separating line for text only. */
    public void printSeparator( GameHTML game ) {
        if (game.textOnly) game.out.printIndent( "----------------\n" );
    }
    
    /** Print the whole game area including the board, the captured pieces and the game history.
     *  @param game the GameHTML with the board status and PrintStream for this board.
     */
    public void print( GameHTML game ) {
        game.out.startTag( "\n" );
          game.out.startTag( "\n" );
            game.out.startTag( "\n" );
            
            game.out.startTag( "\n" );
            
          game.out.endTag( "\n" );
        game.out.endTag( "
\n" ); game.out.startTag( "\n" ); game.out.startTag( "\n" ); game.out.startTag( "\n" ); game.out.endTag( "\n" ); printSeparator( game ); game.out.startTag( "\n" ); game.out.startTag( "\n" ); game.out.endTag( "\n" ); printSeparator( game ); game.out.startTag( "\n" ); game.out.startTag( "\n" ); game.out.endTag( "\n" ); printSeparator( game ); game.out.endTag( "
\n" ); blackStatus.print( game ); game.out.endTag( "
\n" ); boardPrinter.print( game ); game.out.endTag( "
\n" ); whiteStatus.print( game ); game.out.endTag( "
\n" ); game.out.endTag( "
\n" ); historyPrinter.print( game ); game.out.endTag( "
\n" ); } }