Open rand0musername opened 5 years ago
I will add enums for commands in my PR, but let's discuss the rest first.
PR #7 for command (I meant action) enums.
Also I find strategy-centered indexing (e.g. 2 means "second of my items") to be a bit weird, if we're sticking with numbers let's at least use a global indexing (e.g. 2 always means "cookie) and a table somewhere in a PDF.
I prefer strategy-centred indexing, it makes you focus only on the moves you selected. Also, you will otherwise have to verify that every time you return an action, it is a valid one (so game_engine
has to adequately cope with it).
I don't think that would be hard to code from game engine perspective, but I see what you mean.
I am still not the biggest fan of raw numbers (especially when you have ~10 items), maybe strategy_gen.py
could generate local constants that resolve to those numbers (so nothing changes from game engine perspective)? Like ITEM_TEN
instead of 10
? It's a bit dumb but less fragile? Idk
If we're wishing to optimize for the ease of use when defining new strategies, perhaps we should use enums or strings for moves/items in
Strategy
classes. Ideally instead of returning0, 1
fromchoose_action
competitors should returnPERFORM_MOVE, ATTACK
. This is much more readable for complex strategies and I believe will lead to less dumb mistakes.