//==============================================================================
// The code below defines a basic legal player.
// Autogenerated by ggp_template.py
// Replace the definitions of ping, start, play, stop, abort with your code.
//==============================================================================

var role = 'robot';
var startclock = 10;
var playclock = 10;

var library = [];
var roles = [];
var state = [];
var move = 'nil';

//==============================================================================

function ping() {
    return 'ready'
}

function start(r, rs, sc, pc) {
    role = r;
    library = definemorerules([], rs.slice(1));
    roles = findroles(library);
    state = findinits(library);
    startclock = numberize(sc);
    playclock = numberize(pc);
    return 'ready'
}

function play(move) {
    if (move !== nil) {
        state = simulate(move, state, library)
    };
    if (findcontrol(state, library) !== role) {
        return false
    };
    return findlegalx(state, library)
}

function stop(move) {
    return false
}

function abort() {
    return false
}

//==============================================================================
// End of player code
//==============================================================================
