Skip to content

Commit

Permalink
Add a third version ok Sokoban, same than the second but different re…
Browse files Browse the repository at this point in the history
…ward system
  • Loading branch information
HervierLucas committed Oct 7, 2020
1 parent a66d72a commit e8f5198
Show file tree
Hide file tree
Showing 2 changed files with 193 additions and 3 deletions.
6 changes: 3 additions & 3 deletions resources/games/Single-Player/GVGAI/sokoban2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Actions:
- mov: _dest
Dst:
Object: [_empty, hole]

# Boxes can move into empty space
- Src:
Object: box
Expand All @@ -86,7 +86,7 @@ Actions:
Dst:
Object: [box, box_in_place]
Commands:
- exec:
- exec:
Action: move

# If a box is moved into a hole, it should change to in-place box
Expand All @@ -98,7 +98,7 @@ Actions:
- reward: 1
Dst:
Object: hole

# If in-place box is moved into empty space, it should be an empty box
- Src:
Object: box_in_place
Expand Down
190 changes: 190 additions & 0 deletions resources/games/Single-Player/GVGAI/sokoban3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
Version: "0.1"
Environment:
Name: Sokoban - 3
Description: Push the boxes onto the marked spaces
Observers:
Sprite2D:
TileSize: 24
BackgroundTile: gvgai/newset/floor2.png
Player:
AvatarObject: avatar # The player can only control a single avatar in the game
Termination:
Win:
- eq: [box:count, 0] # If there are no boxes left
Levels:
- |
wwwwwwww
ww.....w
ww.hbh.w
ww.bAb.w
w..hbh.w
w......w
wwwwwwww
- |
wwwwwwwwwwww
w....www...w
w.bb.....wAw
w.b.whhh...w
w...wwwwwwww
wwwwwwwwwwww
- |
wwwwwww
w.....w
w.hbh.w
w.bhb.w
w.hbh.w
w.bhb.w
w..A..w
wwwwwww
- |
wwwwww
wh..ww
wAbb.w
ww...w
www..w
wwwwhw
wwwwww
- |
wwwwwwww
www.hhAw
www.bb.w
wwww.www
wwww.www
wwww.www
wwww.www
w....www
w.w...ww
w...w.ww
www...ww
wwwwwwww
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, hole]

# Boxes can move into empty space
- Src:
Object: box
Commands:
- mov: _dest
Dst:
Object: _empty

# The agent can push boxes
- Src:
Object: avatar
Commands:
- mov: _dest
Dst:
Object: [box, box_in_place]
Commands:
- exec:
Action: move

# If a box is moved into a hole, it should change to in-place box
- Src:
Object: box
Commands:
- mov: _dest
- change_to: box_in_place
- reward: 1
Dst:
Object: hole

- Src:
Object: box_in_place
Commands:
- mov: _dest
- change_to: box_in_place
Dst:
Object: hole

# If in-place box is moved into empty space, it should be an empty box
- Src:
Object: box_in_place
Commands:
- mov: _dest
- change_to: box
- reward: -1
Dst:
Object: _empty

Objects:
- Name: box
Z: 2
MapCharacter: b
Observers:
Sprite2D:
- Image: gvgai/newset/block2.png
Block2D:
- Shape: square
Color: [1.0, 0.0, 0.0]
Scale: 0.5

- Name: box_in_place
Z: 2
MapCharacter: f
Observers:
Sprite2D:
- Image: gvgai/newset/block1.png
Block2D:
- Shape: square
Color: [0.0, 1.0, 0.0]
Scale: 0.5

- Name: wall
MapCharacter: w
Observers:
Sprite2D:
- TilingMode: WALL_16
Image:
- gvgai/oryx/wall3_0.png
- gvgai/oryx/wall3_1.png
- gvgai/oryx/wall3_2.png
- gvgai/oryx/wall3_3.png
- gvgai/oryx/wall3_4.png
- gvgai/oryx/wall3_5.png
- gvgai/oryx/wall3_6.png
- gvgai/oryx/wall3_7.png
- gvgai/oryx/wall3_8.png
- gvgai/oryx/wall3_9.png
- gvgai/oryx/wall3_10.png
- gvgai/oryx/wall3_11.png
- gvgai/oryx/wall3_12.png
- gvgai/oryx/wall3_13.png
- gvgai/oryx/wall3_14.png
- gvgai/oryx/wall3_15.png
Block2D:
- Shape: triangle
Color: [0.6, 0.6, 0.6]
Scale: 0.9

- Name: hole
Z: 1
MapCharacter: h
Observers:
Sprite2D:
- Image: gvgai/oryx/cspell4.png
Block2D:
- Shape: triangle
Color: [0.0, 1.0, 0.0]
Scale: 0.6

- Name: avatar
Z: 2
MapCharacter: A
Observers:
Sprite2D:
- Image: gvgai/oryx/knight1.png
Block2D:
- Shape: triangle
Color: [0.2, 0.2, 0.6]
Scale: 1.0

0 comments on commit e8f5198

Please sign in to comment.