void Points::Add_last(Points& other) { Point buf; for (int i = 0, size = other.Size(); i < size; ++i) { buf = other.Get(i); Add_last(buf.x, buf.y); } }
bool TableCloth::put_coockie(Points& reverse_list) { char cookie = m_turn_player ? 'o' : 'x'; Point put_point = { -1, -1, }; int start_i_j = ( m_turn_player ? 0 : 7 ); int end_i_j = ( m_turn_player ? 8 : -1); int change_num = ( m_turn_player ? 1 : -1); for (int i = start_i_j; i != end_i_j; i += change_num) { for (int j = start_i_j; j != end_i_j; j += change_num) { if ( m_table_cloth[i][j] != '.' ) continue; Point start = { i, j, }; Points buf_list; for (int x = -1; x <= 1; ++x) { for (int y = -1; y <= 1; ++y) { if ( x == 0 and y == 0 ) continue; Find_place(start, x, y, cookie, buf_list); } } if (reverse_list.Size() < buf_list.Size() ) { reverse_list = buf_list; put_point.x = i; put_point.y = j; } } } if ( put_point.x == -1 and put_point.y == -1 ) return false; m_table_cloth[put_point.x][put_point.y] = cookie; return true; }