# Path: stripstream/utils.py
# def random_sequence(sequence):
#     indices = range(len(sequence))
#     shuffle(indices)
#     for i in indices:
#         yield sequence[i]
# 
# def irange(start, end, step=1):
#     n = start
#     while n < end:
#         yield n
#         n += step


from collections import namedtuple
from random import random
from time import sleep
from stripstream.utils import random_sequence, irange

def sample_grasp_problem(block_w=1., block_h=1., env_w=10.):
    env_region = Region('env', 0., env_w)

    blocks = [
        Block('block0', block_w, block_h, 'red'),
    ]

    initial_regions = [
        env_region,
    ]

    initial_config = 0
    initial_holding = None
    initial_poses = sample_block_poses(zip(blocks, initial_regions))

    goal_config = None
    goal_holding = blocks[0]
    goal_poses = []
    goal_regions = []

    return TMPProblem(env_region, initial_config, initial_holding, initial_poses,
                      goal_config, goal_holding, goal_poses, goal_regions)


def sample_tamp_problem(block_w=1., block_h=1.):
    env_region = Region('env', 0., 20.)

    blocks = [
        Block('block0', block_w, block_h, 'red'),

# Path: stripstream/utils.py
# def random_sequence(sequence):
#     indices = range(len(sequence))
#     shuffle(indices)
#     for i in indices:
#         yield sequence[i]
# 
# def irange(start, end, step=1):
#     n = start
#     while n < end:
#         yield n
#         n += step


# Path: stripstream/pddl/examples/continuous_tamp/continuous_tamp_utils.py
from collections import namedtuple
from random import random
from time import sleep
from stripstream.utils import random_sequence, irange


def sample_grasp_problem(block_w=1., block_h=1., env_w=10.):
    env_region = Region('env', 0., env_w)

    blocks = [
        Block('block0', block_w, block_h, 'red'),
    ]

    initial_regions = [
        env_region,
    ]

    initial_config = 0
    initial_holding = None
    initial_poses = sample_block_poses(zip(blocks, initial_regions))

    goal_config = None
    goal_holding = blocks[0]
    goal_poses = []
    goal_regions = []

    return TMPProblem(env_region, initial_config, initial_holding, initial_poses,
                      goal_config, goal_holding, goal_poses, goal_regions)


def sample_tamp_problem(block_w=1., block_h=1.):
    env_region = Region('env', 0., 20.)

    blocks = [
        Block('block0', block_w, block_h, 'red'),

        Block('block1', block_w, block_h, 'blue'),