Ejemplo n.º 1
0
Archivo: move.c Proyecto: ujh/HouseBot
/* No sanity checking */
coord_t *
str2coord(char *str, int size)
{
	if (!strcasecmp(str, "pass")) {
		return coord_pass();
	} else if (!strcasecmp(str, "resign")) {
		return coord_resign();
	} else {
		char xc = tolower(str[0]);
		return coord_init(xc - 'a' - (xc > 'i') + 1, atoi(str + 1), size);
	}
}
Ejemplo n.º 2
0
static coord_t *
proof_genmove(struct engine *e, struct board *b, struct time_info *ti, enum stone color, bool pass_all_alive)
{
    coord_t *coord;
    fprintf(stderr, "HELLO WORLD!");
    struct board b2;
    board_copy(&b2, b);
    for (int i=0; i<=19; i++){
        for (int j=0; j<=19; j++){
            coord = coord_init(i,j,board_size(&b2));
            if (board_is_valid_play(&b2, color, *coord))
                return coord;
        }
    }
    *coord = -1;
    return coord;
}
Ejemplo n.º 3
0
void drawPlateau(Item *items[], SDL_Surface *screen, Plateau p) {
    if (items[0]->on_screen) {
        Pion pion = NULL;
        SDL_Rect pos;
        Coordonnee coord = coord_init();
        for (unsigned int i = 0; i < TAILLE; i++) {
            for (unsigned int j = 0; j < TAILLE; j++) {
                coord_set(coord, j, i);
                if ((pion = plateau_get_pion(p, coord)) != NULL) {
                    pos = pion_to_pixel(pion);
                    if (pion_get_couleur(pion) == ROUGE)
                        apply_surface(HEXPOS_X + pos.x, HEXPOS_Y + pos.y, items[2]->surface, screen);
                    else
                        apply_surface(HEXPOS_X + pos.x, HEXPOS_Y + pos.y, items[1]->surface, screen);
                }
            }
        }
        apply_surface(HEXPOS_X, HEXPOS_Y, items[0]->surface, screen);
    }
}