Skip to content

Commit

Permalink
Add example grid with explanation as docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
jessesnyder committed Nov 6, 2024
1 parent d43d465 commit 2d67882
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
19 changes: 19 additions & 0 deletions dlgr/griduniverse/csv_gridworlds.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,25 @@
def matrix2gridworld(matrix):
"""Transform a 2D matrix representing an initial grid state
into the serialized format used by Gridworld.
Example:
+---------------+---------+--------------------+
| w | stone | gooseberry_bush|3 |
| p1c1 | w | w |
| | | p3c2 |
| | p4c2 | |
| big_hard_rock | w | p2c1 |
+---------------+---------+--------------------+
Explanation:
- "w": a wall
- "stone": item defined by item_id "stone" in game_config.yml
- "gooseberry_bush|3": similar to the above, with the added detail
that the item has 3 remaining uses
- "p2c1": player ID 2, who is on team (color) 1
- Empty cells: empty space in the grid
"""
result = defaultdict(list)

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,6 @@
"bugs": {
"url": "https://github.com/Dallinger/Griduniverse/issues"
},
"homepage": "https://github.com/Dallinger/Griduniverse#readme"
"homepage": "https://github.com/Dallinger/Griduniverse#readme",
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}

0 comments on commit 2d67882

Please sign in to comment.