Containers #16

Open
opened 2025-08-14 18:39:07 -07:00 by oakbrad · 1 comment
oakbrad commented 2025-08-14 18:39:07 -07:00 (Migrated from github.com)

I've written out some basic container classes: Shelf, BookShelf, WeaponRack.

I think the upstream classes should be more generic: IndexContainer and GridContainer

The difference is in how things are stored:

  • IndexContainer - each item put in the container gets an index assigning it a slot that is removed when its taken out
  • GridContainer - each item gets an (x,y) coordinate related to it's spot on the shelf that is also removed when it's taken out

Shelf/BookShelf should be subclassed to GridContainer

WeaponRack should be a IndexContainer

Todo

  • LiquidContainerMixin
  • IndexContainer
  • GridContainer
I've written out some basic container classes: Shelf, BookShelf, WeaponRack. I think the upstream classes should be more generic: IndexContainer and GridContainer The difference is in how things are stored: * IndexContainer - each item put in the container gets an index assigning it a slot that is removed when its taken out * GridContainer - each item gets an (x,y) coordinate related to it's spot on the shelf that is also removed when it's taken out Shelf/BookShelf should be subclassed to GridContainer WeaponRack should be a IndexContainer ## Todo - [x] LiquidContainerMixin - [ ] IndexContainer - [ ] GridContainer
oakbrad commented 2025-09-01 21:58:43 -07:00 (Migrated from github.com)

I also need a LiquidContainerMixin that marks something as a liquid container, where the capacity would be treated as ounces.

https://realpython.com/python-mixin/

I also need a LiquidContainerMixin that marks something as a liquid container, where the capacity would be treated as ounces. https://realpython.com/python-mixin/
Sign in to join this conversation.
No description provided.