196 days ago · Tech · hide · Fediverse post

I have a bit of time at the keyboard. Let’s improve the dungeon contents code a bit. Let’s allow for more than one content item. We can do that with a test, I think. def test_contents_is_collection(self): layout = DungeonLayout(10, 10) room_cell = layout.at(5, 5) room = Room([room_cell]) layout.add_room(room) dungeon = Dungeon(layout) dungeon.place_content_at(room_cell,"treasure") dungeon.place_content_at(room_cell,"more treasure") contents = dungeon.contents_at(room_cell.xy) assert len(contents) == 2 I don’t like that I need this much setup for the test. We’ll think of something to do about that. First make it work. I think this will break DungeonView, and that reminds me that our original test doesn’t test very much: def test_place_content(self): layout = DungeonLayout(10, 10) room_cell = layout.at(5, 5) room = Room([room_cell]) layout.add_room(room) dungeon = Dungeon(layout) dungeon.place_content_at(room_cell,"treasure") I think we’ll probably just let that one get removed, the…

Commenting on Bubbles has been removed. Why? If you want to talk about this post, write to the author, use the comments on their blog if it has them, or reply with a "RE:" post on your own blog. Suggestions? feedback@bubbles.town