Exemplo n.º 1
0
void Game::put_stone(int x, int y){
    // get the sender == currentPlayer
    if (board.putStone(x, y, currentPlayer))
        emit draw_stone(x, y, currentPlayer ? IView::BLACK : IView::WHITE);
    else
        emit message("This cell is already occupied.");
}
Exemplo n.º 2
0
void Game::load_game(string filename){
    QFile in(filename.c_str());
    GameState gs(in);
    board.RestoreGame(gs);
    for (unsigned i = 0; i<board.getRowCount();i++)
        for (unsigned j = 0; j<board.getColCount(); j++)
            if (board[i][j] != 0)
                emit draw_stone(i, j, (board[i][j] > 0) ? IView::BLACK : IView::WHITE);
    emit set_control_settings(IView::control_setting::LOCAL_GAME);
}
Exemplo n.º 3
0
static void
draw_all_stones (void)
{
    unsigned int x, y;
    unsigned short temp_pos;

    for (x = MIN_X; x < MAX_X; ++x)
    {
        for (y = MIN_Y; y < MAX_Y; ++y)
        {
            temp_pos = POS (x, y);
            if (get_point_board (temp_pos) == EMPTY)
            {
                continue;
            }

            draw_stone (temp_pos, get_point_board (temp_pos) == BLACK);
        }
    }
}
Exemplo n.º 4
0
void			check_draw(char *tmp)
{
	if (my_strcmp(tmp, "linemate") == 0)
		draw_stone(1);
	if (my_strcmp(tmp, "deraumere") == 0)
		draw_stone(2);
	if (my_strcmp(tmp, "sibur") == 0)
		draw_stone(3);
	if (my_strcmp(tmp, "mendiane") == 0)
		draw_stone(4);
	if (my_strcmp(tmp, "phiras") == 0)
		draw_stone(5);
	if (my_strcmp(tmp, "thystame") == 0)
		draw_stone(6);
	if (my_strcmp(tmp, "nourriture") == 0)
		draw_food();
	if (my_strcmp(tmp, "player") == 0)
		draw_player();
}