
gametools v0.8.0 released
Hey Rustaceans -
I just pushed / published v0.8.0 of gametools on github & crates. It's a moderately big update.
The biggest changes:
ordering module
Module with types and helpers for managing ordered queues and collections.
RankedOrder<R,T,D>is Vec-backed collection optimized for burst usage, small to moderate queue sizes, and when you may need the complete order.PriorityQueue<P,T,O>is BinaryHeap-backed, optimized for rapid push()/pop() cycling and when you only care about the highest priority item.
These collections can hold any type and be ordered by any type that is Ord. Rust's type system is also leveraged so that each can be used as either a min-first or max-first version without having to wrap your types in Reverse<T> or other such annoyance.
dice module rewrite
I started the old module when I was very new to Rust, and the API had multiple personality disorder -- part result generator, part physical die simulator, part game rule engine. This has been focused on broadly reusable result generation and analysis.
refilling_pool module
RefillingPool<T> is a collection of 1+ items of any type from which you can draw indefinitely, but it's more than just a random draw:
- no item can be drawn twice before all items are drawn once -- the pool of items refills whenever exhausted.
- a predicate closure can be supplied to allow preferential draw of certain elements within the pool.
- a context can also be supplied with the predicate (of any kind, including a full game state) to further tune the preferred yield.
- caller can choose whether
Noneis returned if no preferred items are available or whether to fall back to some other random item from the pool.
examples updated
- the Yahtzee agent example is gone; it depended too heavily on the old
diceAPI to save it. - new short example uses (an infinite chest that yield preferred items according to character state, attack priorities for a fleet, and a turns-by-initiative queue) have been added for the modules above.
Feedback / contributions / suggestions always welcome!