/*
 *  Example of a Caissa player program for the CodeCup.
 *
 *  This only demonstrates how to do the input and output. You will
 *  have to write the algorithms for the game all by yourself.
 *
 *  We use numbers 0..6 to refer to columns A..G,
 *  and numbers 0..6 to refer to rows 1..7.
 */

#include <stdlib.h>
#include <stdio.h>
#include <string.h>


/* This variable is set to non-zero if we are playing white. */
int i_am_playing_white;


/*
 *  This function resets the game board to the initial position.
 */
void init_game_board(void)
{
        /* TODO */
}


/*
 *  This function selects the best move for us to make now.
 */
void select_my_best_move(int *fromcol, int *fromrow, int *tocol, int *torow)
{
        /* TODO */
}


/*
 *  This function updates the game board with a move from the opponent.
 */
void do_opponent_move(int fromcol, int fromrow, int tocol, int torow)
{
        /* TODO */
}


int main(void)
{
        char buf[40];
        int fromcol, fromrow, tocol, torow;
        char fc, tc;
        int fr, tr;

        /* Set the game board to its initial position */
        init_game_board();

        /* Read the first line of input */
        scanf("%s", buf);

        /* The first line contains 'start' if we are playing white */
        if (strcmp(buf, "start") == 0) {

                /* We are playing white */
                i_am_playing_white = 1;

                /* Select our first move */
                select_my_best_move(&fromcol, &fromrow, &tocol, &torow);

                /* Write our first move */
                printf("%c%d-%c%d\n",
                       'a'+fromcol, 1+fromrow,
                       'a'+tocol, 1+torow);
                fflush(stdout);

                /* Read the next line of input */
                scanf("%s", buf);

        } else {

                /* We are playing black */
                i_am_playing_white = 0;

        }

        /* Repeat this until the end of the game */
        while ( strcmp(buf, "end") != 0 ) {

                /* Parse the opponnent's move */
                sscanf(buf, "%c%d-%c%d", &fc, &fr, &tc, &tr);
                fromcol = fc - 'a';
                fromrow = fr - 1;
                tocol = tc - 'a';
                torow = tr - 1;

                /* Update the game board */
                do_opponent_move(fromcol, fromrow, tocol, torow);

                /* Select the best move for us */
                select_my_best_move(&fromcol, &fromrow, &tocol, &torow);

                /* Write the selected move to the output */
                printf("%c%d-%c%d\n",
                       'a'+fromcol, 1+fromrow,
                       'a'+tocol, 1+torow);
                fflush(stdout);

                /* Read the next line of input */
                scanf("%s", buf);
        }

        return 0;
}

/* End */

syntax highlighted by Code2HTML, v. 0.9.1