ELOGL26SONVBON2Q7MTZY2AW3ERCUMCHM3YLV7AJDG7ZYL6ET7SAC
#[cfg(test)]
mod tests {
use super::*;
/// These are uniquely assigned to players and *never* change.
// (Thus they should *not* be present in BoardState)
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct PlayerId(ulid::Ulid);
/// The kinds of actions that exist
pub enum ActionPayload {}
/// Represents an action that a player may take
struct Action {
payload: ActionPayload,
player: PlayerId,
#[cfg(test)]
mod tests {}
- the main directory contains the engine with consists of:
- a non-reactive publically mutable version of game state: the `BoardState`
- an opaque reactive version of game state: the `RunningGame`
## Design Ideas
I will try Domain-Oriented Design, so I'm splitting things into the `BoardState` and `RunningGame`.
A `BoardState` is meant to be externally manipulable, so it relies on having public owned data.
Avoid strategies for deduplication, it should be *really* straight-forward to make w/e changes you want
that *could* be proper game actions from the `BoardState`.
A `RunningGame` should be optimized for *running* a game, and reducers and inferers work with this struct.
I'm keeping the idea for having reducers and inferers, but due to the difference in using DOD, we can change some signatures:
- a reducer is an `fn(&mut RunnningGame, act: Action) -> &mut RunningGame`, it can now mutate a RunningGame,
as RunningGame is no longer responsible for being serializable or externally manipulable in general.
- an inferer is `fn(&RunningGame) -> Vec<Action>` and should list all the possible actions that can be taken.
- and we need something that can produce `BoardState`s `fn(&RunningGame) -> BoardState`, possibly memoized
in case *creating* the `BoardState` is expensive.
[[package]]
name = "loom"
version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff50ecb28bb86013e935fb6683ab1f6d3a20016f123c76fd4c27470076ac30f5"
dependencies = [
"cfg-if",
"generator",
"pin-utils",
"scoped-tls",
"tracing",
"tracing-subscriber",
]
"regex-automata",
"regex-syntax",
"regex-automata 0.4.6",
"regex-syntax 0.8.3",
]
[[package]]
name = "regex-automata"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
dependencies = [
"regex-syntax 0.6.29",
name = "tracing-subscriber"
version = "0.3.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b"
dependencies = [
"matchers",
"nu-ansi-term",
"once_cell",
"regex",
"sharded-slab",
"smallvec",
"thread_local",
"tracing",
"tracing-core",
"tracing-log",
]
[[package]]