Zen Puzzle

Single-Player/GVGAI/zenpuzzle.yaml

Description

Set all the tiles in the level to the same color, but you cannot move over a tile more than once! (Not even sure why this is zen its super frustrating)

Levels

Code Example

The most basic way to create a Griddly Gym Environment. Defaults to level 0 and SPRITE_2D rendering.

import gym
import griddly

if __name__ == '__main__':

    env = gym.make('GDY-Zen-Puzzle-v0')
    env.reset()

    # Replace with your own control algorithm!
    for s in range(1000):
        obs, reward, done, info = env.step(env.action_space.sample())
        env.render() # Renders the environment from the perspective of a single player

        env.render(observer='global') # Renders the entire environment

        if done:
            env.reset()

Objects

Tiles

Name ->

avatar

ground

rock

Map Char ->

A

g

r

Block2D

../../_images/Zen_Puzzle-tile-avatar-Block2D.png ../../_images/Zen_Puzzle-tile-ground-Block2D.png ../../_images/Zen_Puzzle-tile-rock-Block2D.png

Sprite2D

../../_images/Zen_Puzzle-tile-avatar-Sprite2D.png ../../_images/Zen_Puzzle-tile-ground-Sprite2D.png ../../_images/Zen_Puzzle-tile-rock-Sprite2D.png

Vector

../../_images/Zen_Puzzle-tile-avatar-Vector.png ../../_images/Zen_Puzzle-tile-ground-Vector.png ../../_images/Zen_Puzzle-tile-rock-Vector.png

Actions

move

Action Id

Mapping

1

Left

2

Up

3

Right

4

Down

YAML

Version: "0.1"
Environment:
  Name: Zen Puzzle
  Description: Set all the tiles in the level to the same color, but you cannot move over a tile more than once! (Not even sure why this is zen its super frustrating)
  Observers:
    Sprite2D:
      TileSize: 24
      BackgroundTile: gvgai/oryx/backBiege.png
  Player:
    AvatarObject: avatar
  Termination:
    Win:
      - eq: [ground:count, 0]
    Lose:
      - eq: [_steps, 1000]
  Levels:
    - |
      ............
      ............
      ............
      ...gggggg...
      ...gggggg...
      ...gggggg...
      .A.ggrrgg...
      ...gggggg...
      ...gggggg...
      ............
      ............
      ............
    - |
      ............
      ............
      ............
      ...gggggg...
      ...ggggrg...
      ...gggggg...
      .A.ggrggg...
      ...gggggg...
      ...gggggg...
      ............
      ............
      ............
    - |
      ............
      ............
      ............
      ...gggggg...
      ...gggrgg...
      ...gggggg...
      .A.grgggg...
      ...ggggrg...
      ...gggggg...
      ............
      ............
      ............
    - |
      ............
      ............
      ............
      ...ggrrgg...
      ...rggggr...
      .A.ggrrgg...
      ...rggggr...
      ...ggrrgg...
      ............
      ............
      ............
    - |
      ............
      ............
      ............
      ...rggggg...
      ...ggrgrg...
      ...rgggrg...
      .A.ggrggg...
      ...rgggrg...
      ...ggrggg...
      ............
      ............
      ............

Actions:
  # Define the move action
  - Name: move
    Behaviours:
      # The agent can move around freely in empty space and over holes
      - Src:
          Object: avatar
          Commands:
            - mov: _dest

        Dst:
          Object: _empty

      - Src:
          Object: avatar
          Commands:
            - mov: _dest
        Dst:
          Object: ground
          Commands:
            - change_to: walked
            - reward: 1

Objects:
  - Name: avatar
    MapCharacter: A
    Z: 1
    Observers:
      Sprite2D:
        - Image: gvgai/oryx/angel1.png
      Block2D:
        - Shape: square
          Color: [0.8, 0.2, 0.2]
          Scale: 0.6

  - Name: ground
    MapCharacter: g
    Observers:
      Sprite2D:
        - Image: gvgai/oryx/floorTileOrange.png
      Block2D:
        - Shape: square
          Color: [0.2, 0.2, 0.4]
          Scale: 0.7

  - Name: walked
    Z: 0
    Observers:
      Sprite2D:
        - Image: gvgai/oryx/floorTileGreen.png
      Block2D:
        - Shape: square
          Color: [0.2, 0.6, 0.2]
          Scale: 0.8

  - Name: rock
    MapCharacter: r
    Observers:
      Sprite2D:
        - Image: gvgai/oryx/wall5.png
      Block2D:
        - Shape: triangle
          Color: [0.2, 0.2, 0.2]
          Scale: 0.8