-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ArchUnit and rename interfaces to standardize architecture #320
- Loading branch information
Showing
41 changed files
with
296 additions
and
177 deletions.
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
games-dsl/common/src/main/kotlin/net/zomis/games/api/Scopes.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package net.zomis.games.api | ||
|
||
import net.zomis.games.PlayerEliminationsRead | ||
import net.zomis.games.PlayerEliminationsWrite | ||
import net.zomis.games.dsl.GameConfig | ||
import net.zomis.games.dsl.impl.Game | ||
|
||
interface Scope | ||
interface PrimitiveScope: Scope | ||
interface CompoundScope: Scope | ||
interface UsageScope: Scope | ||
|
||
interface GameModelScope<T: Any>: PrimitiveScope { | ||
val model: T | ||
} | ||
interface PlayerCountScope: PrimitiveScope { | ||
val playerCount: Int | ||
val playerIndices get() = (0 until playerCount) | ||
} | ||
interface GameScope<T: Any>: PrimitiveScope { | ||
val game: Game<T> | ||
} | ||
interface ReplayableScope: PrimitiveScope { | ||
val replayable: net.zomis.games.dsl.ReplayStateI | ||
} | ||
interface EventScope<E>: PrimitiveScope { | ||
val event: E | ||
} | ||
interface ValueScope<V>: PrimitiveScope { | ||
val value: V | ||
} | ||
interface EliminationsScope: PrimitiveScope { | ||
val eliminations: PlayerEliminationsRead | ||
} | ||
interface MutableEliminationsScope: PrimitiveScope { | ||
val eliminations: PlayerEliminationsWrite | ||
} | ||
interface ActionScope<A: Any>: PrimitiveScope { | ||
val action: A | ||
} | ||
interface ConfigScope: PrimitiveScope { | ||
fun <C: Any> config(config: GameConfig<C>): C | ||
} | ||
interface PlayerIndexScope: PrimitiveScope { | ||
val playerIndex: Int | ||
} | ||
/* | ||
interface LogScope<T: Any>: PrimitiveScope { | ||
suspend fun log(logging: LoggingScope<T>.() -> String) | ||
suspend fun logSecret(player: PlayerIndex, logging: LoggingScope<T>.() -> String): LogSecretScope<T> | ||
} | ||
*/ | ||
|
||
/* | ||
Categories: | ||
- Events / Triggers | ||
- Rules | ||
- Actions | ||
- ActionsChosen | ||
- Game setup | ||
- GameFlow | ||
- GameFlowStep | ||
- Metrics | ||
- Scorers | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.