try:
    import importlib.resources as pkg_resources
except ImportError:
    # Try backported to PY<37 `importlib_resources`.
    import importlib_resources as pkg_resources
from . import images

from gym import Env, spaces

from time import time
import numpy as np
from copy import copy
import colorsys

import pygame
from pygame.transform import scale

class MinesweeperEnv(Env):

    def __init__(self, grid_shape=(10, 15), bombs_density=0.1, n_bombs=None, impact_size=3, max_time=999, chicken=False):
        self.grid_shape = grid_shape
        self.grid_size = np.prod(grid_shape)
        self.n_bombs = max(1, int(bombs_density * self.grid_size)) if n_bombs is None else n_bombs
        self.n_bombs = min(self.grid_size - 1, self.n_bombs)
        self.flaged_bombs = 0
        self.flaged_empty = 0
        self.max_time = max_time

        if impact_size % 2 == 0:
            raise ValueError('Impact_size must be an odd number !')
        self.impact_size = impact_size

        # Define constants
        self.HIDDEN = 0
        self.REVEAL = 1
        self.FLAG = 2
        self.BOMB = self.impact_size ** 2
        
        # Setting up gym Env conventions
        nvec_observation = (self.BOMB + 2) * 
np.ones(self.grid_shape)