rl-video-episode-21.mp4
git clone https://github.com/helpingstar/gym-woodoku.git
cd gym-woodoku
pip install -e .
import gym_woodoku
import gymnasium as gym
env = gym.make('gym_woodoku/Woodoku-v0', game_mode='woodoku', render_mode='human')
# env = gym.wrappers.RecordVideo(env, video_folder='./video_folder')
observation, info = env.reset()
for i in range(100000):
action = env.action_space.sample()
obs, reward, terminated, _, info = env.step(action)
if terminated:
env.reset()
env.close()
Dict({
"board": Box(low=0, high=1, shape=(9, 9), dtype=np.int8),
"block_1": Box(low=0, high=1, shape=(5, 5), dtype=np.int8),
"block_2": Box(low=0, high=1, shape=(5, 5), dtype=np.int8),
"block_3": Box(low=0, high=1, shape=(5, 5), dtype=np.int8),
})
Location of Blocks in Array :
Wrap the block in a rectangle.
- If side length is odd :
len(side) // 2
- If side length is even :
len(side) // 2 - 1
Each point is placed at the index (2,2)
of the size array (5,5)
. (zero based)
example)
action_space : Discrete(243)
- 0~80 : use
block_1
- Place
block_1
at ((action-0) // 9, (action-0) % 9)
- Place
- 81~161 : use
block_2
- Place
block_2
at ((action-81) // 9, (action-81) % 9)
- Place
- 162~242 : use
block_3
- Place
block_3
at ((action-162) // 9, (action-162) % 9)
- Place
example
action == 0
- Take
block_1
and place it at position(0, 0)
based on the center of the block.
- Take
action == 212
- Take
block_3
and place it at position(5, 5)
based on the center of the block.
- Take
import gym_woodoku
import gymnasium as gym
env = gym.make('gym_woodoku/Woodoku-v0',
game_mode: str = 'woodoku',
render_mode: str = None,
crash33: bool = True)
game_mode
: Gets the type of block to use in the game.woodoku
crash33
: If true, when a 3x3 cell is filled, that portion will be broken.render_modes
: Determines gym rendering method.ansi
: The game screen appears on the console.human
: continuously rendered in the current displayrgb_array
: return a single frame representing the current state of the environment. Use with RecordVideo Wrapper if you want to save episodes.