# Path: roglick/engine/random.py
# class Random(object):
#     def __init__(self, seed=None, generator=None):
#     def generator(self):
#     def get_int(self, min=None, max=None):
#     def flip_coin(self):
#     def roll_dice(self, num=1, sides=6):
#     def one_in(self, odds):
#     def probability(self, prob):
#     def choice(self, choices):
#     def shuffle(self, deck):
# def get_int(*args, **kwargs):
# def flip_coin():
# def roll_dice(*args, **kwargs):
# def one_in(*args, **kwargs):
# def probability(*args, **kwargs):
# def choice(*args, **kwargs):
# def shuffle(*args, **kwargs):
# 
# Path: roglick/utils.py
# def clamp(val, min_val, max_val):
#     return max(min_val, min(max_val, val))


from roglick.engine import random
from roglick.utils import clamp
def smoothstep(a, b, x):
    """Basic S-curve interpolation function.

    Based on reference implementation available at
    https://en.wikipedia.org/wiki/Smoothstep
    """
    x = clamp((x - a)/(b - a), 0.0, 1.0)
    return x*x*(3 - 2*x)

def smootherstep(a, b, x):
    """Improved S-curve interpolation function.

    Based on reference implementation of the improved algorithm proposed by
    Ken Perlin that is available at https://en.wikipedia.org/wiki/Smoothstep
    """
    x = clamp((x - a)/(b - a), 0.0, 1.0)
    return x*x*x*(x*(x*6 - 15) + 10);

def lerp(a, b, x):
    """Linear interpolation function."""
    return a + x * (b - a)


class PerlinNoise2D(object):
    def __init__(self, seed=None):
        self.p = [x for x in range(256)]

        if seed is None:
            seed = random.get_int()


# Path: roglick/engine/random.py
# class Random(object):
#     def __init__(self, seed=None, generator=None):
#     def generator(self):
#     def get_int(self, min=None, max=None):
#     def flip_coin(self):
#     def roll_dice(self, num=1, sides=6):
#     def one_in(self, odds):
#     def probability(self, prob):
#     def choice(self, choices):
#     def shuffle(self, deck):
# def get_int(*args, **kwargs):
# def flip_coin():
# def roll_dice(*args, **kwargs):
# def one_in(*args, **kwargs):
# def probability(*args, **kwargs):
# def choice(*args, **kwargs):
# def shuffle(*args, **kwargs):
# 
# Path: roglick/utils.py
# def clamp(val, min_val, max_val):
#     return max(min_val, min(max_val, val))


# Path: roglick/dungeon/utils.py
from roglick.engine import random
from roglick.utils import clamp

def smoothstep(a, b, x):
    """Basic S-curve interpolation function.

    Based on reference implementation available at
    https://en.wikipedia.org/wiki/Smoothstep
    """
    x = clamp((x - a)/(b - a), 0.0, 1.0)
    return x*x*(3 - 2*x)

def smootherstep(a, b, x):
    """Improved S-curve interpolation function.

    Based on reference implementation of the improved algorithm proposed by
    Ken Perlin that is available at https://en.wikipedia.org/wiki/Smoothstep
    """
    x = clamp((x - a)/(b - a), 0.0, 1.0)
    return x*x*x*(x*(x*6 - 15) + 10);

def lerp(a, b, x):
    """Linear interpolation function."""
    return a + x * (b - a)


class PerlinNoise2D(object):
    def __init__(self, seed=None):
        self.p = [x for x in range(256)]

        if seed is None:
            seed = random.get_int()


        rand = random.Random(seed)