
/* position_status.c -- set up a position and display the board plus
 * everything curr_e (sandef.h) tracks about it: side to move,
 * castling rights, the en passant target square, the halfmove
 * clock, and the fullmove number.
 */

#include <stdio.h>

#include "sandef.h"
#include "sanvar.h"

#include "sanint.h"
#include "sandsp.h"
#include "sanfen.h"

int main (void)
{
  SANInit ();
  SANFENSet ("rnbqkbnr/ppp1pppp/8/3pP3/8/8/PPPP1PPP/RNBQKBNR w KQkq d6 0 3");

  SANDspBoard ();

  printf ("\nSide to move:     %s\n",
          (curr_e.e_actc == c_w) ? "White" : "Black");

  printf ("Castling rights:  %s%s%s%s\n",
          (curr_e.e_cast & cast_wk) ? "K" : "",
          (curr_e.e_cast & cast_wq) ? "Q" : "",
          (curr_e.e_cast & cast_bk) ? "k" : "",
          (curr_e.e_cast & cast_bq) ? "q" : "");

  if (curr_e.e_epsq == sq_nil)
    printf ("En passant:       (none)\n");
  else
    printf ("En passant:       %c%c\n",
            acfv[map_file_sq (curr_e.e_epsq)],
            acrv[map_rank_sq (curr_e.e_epsq)]);

  printf ("Halfmove clock:   %d\n", curr_e.e_hmvc);
  printf ("Fullmove number:  %d\n", curr_e.e_fmvn);

  return (0);
}
