All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
-
TurnStage
,Game.turn_stage
andGameState.turn_stage
(rules already had to rely on the private version).Player.is_owning(region)
helper method.
- In asset files,
"has_a_lost_tribe": true
now must be set as"symbols": ["Lost Tribe", ...]
instead.
--style=machine
option forsmawg play
.show-turn
command forsmawg play
.
- Autocompletion in
smawg play
became much smarter and appropriately suggests arguments, dry runs or dead ends instead of always suggesting commands.
smawg.basic_rules.Action
and its variants:Decline
,SelectCombo
,Abandon
,Conquer
,ConquerWithDice
,StartRedeployment
,Deploy
,EndTurn
.smawg.default_rules.Action
(currently, it's the same assmawg.basic_rules.Action
).Game.do()
method as a single entry point for performing anyAction
.AbstractRules.check()
method as a single entry point for checking anyAction
.- Its implementations in
smawg.basic_rules
andsmawg.default_rules
.
- Its implementations in
- Error messages in
smawg play
. - Rule plugins now must implement
AbstractRules.check()
. AbstractRules
is now aGeneric
class, old code may not typecheck.
Map.adjacent
property.smawg play
subcommand as the new recommended way to runsmawg.cli
.smawg viz
subcommand as the new recommended way to runsmawg.viz
.
smawg.cli
entry point in favor ofsmawg play
.smawg.viz
entry point in favor ofsmawg viz
.
roll_dice()
convenience function.Assets.shuffle()
convenience method.Game.assets
andGameState.assets
properties.
Combo
is now a dataclass that's compared by value.Game
no longer shufflesassets
by default or provides a switch for this. If you need this functionality, useAssets.shuffle()
.- Maps are no longer allowed to contain "borders" between some tile and itself.
Game.n_turns
andGameState.n_turns
. Prefer.assets.n_turns
instead.
- Parameter
shuffle_data
ofGame.__init__()
. If you need this functionality, useAssets.shuffle()
.
smawg.viz --format=''
now acts as--no-render
.- Improvements in
smawg.viz
output:- Standard terrain types and symbols are now rendered in color.
- Edges no longer overlap with nodes.
- Large maps look more dense than before.
- In generated labels, region symbols are now always sorted.
- Generated labels now contain escaped newlines instead of raw newlines.
smawg.viz --no-render
(use--format=''
instead).
Region.symbols
field to support symbols like "Cavern", "Magic Source" and "Mine". This field is empty by default.- Assets for the standard 2, 3, 4 and 5 player game setups.
-
smawg.viz
now also displaysRegion.symbols
. -
To reduce verbosity of map assets,
"has_a_lost_tribe"
and"is_at_map_border"
are now optional and false by default. -
The minimum number of
races
andabilities
in assets is lowered to2*n_players
andn_players
respectively. See the next change for reasons. -
The semantics of
n_selectable_combos
has changed. Previously, it required exactlyn_selectable_combos
at any moment:assert len(game.combos) == n_selectable_combos
But that rule is too strict. It doesn't even allow the standard 5 player setup, demanding to add a 15th race to the game.
What we really care about is having at least 1 combo when the current player must pick a combo to proceed. In other situations, it's ok to have 0. And at any moment, there should be no more than
n_selectable_combos
:if game.player.active_ability is None: assert 1 <= len(game.combos) <= n_selectable_combos else: assert len(game.combos) <= n_selectable_combos
This should be enough to prevent stuck situations in common game configurations.
- Dependency on
pydantic
. - Strongly typed
Map
andAssets
objects. Game.__init__()
overload that acceptsAssets
instead ofdict
.- Package-level CLI entry point (
smawg
) withschema
subcommand to generate JSON schema.
GameState
constructor now accepts assets asAssets
instead ofdict
.validate()
andGame.__init__()
now raisepydantic.ValidationError
instead ofjsonschema.exceptions.ValidationError
orsmawg.InvalidAssets
.
- Parameter
strict
ofvalidate()
.
- Dependency on
jsonschema
. - JSON schema in
smawg/assets_schema/
(now in can be autogenerated, see README.md) InvalidAssets
exception class (pydantic.ValidationError
is used instead).
Game.owner_of()
andGameState.owner_of()
.- Exposed
Game.rules
, allowing to "dry run" an action and check if it's valid. - Support for dry runs in
smawg.cli
('?' operator).
- Rule plugins now bound-check their arguments and yield
ValueError
instead of just assuming that they're valid. - Updated instructions in
README.md
to usevenv
.
- Support for Python 3.10.
- Typo in
docs/rules.md
.
is_in_redeployment_turn
property ofGame
andGameState
.
Game.conquer(..., use_dice=True)
now returns the value rolled on the dice.- Documentation on game hooks now discourages their use. They may be deprecated in future versions.
- Required
flake8
plugins are now specified insetup.cfg
.
- Typing in tests.
- Rules documentation not matching the test case.
- Broken file link in README.md.
- Unescaped square brackets in markdown.
- Effects from different terrain types:
- Allow to start the conquests from a non-edge region whose shore is on a Sea adjacent to the edge of the board.
- Conquering a Mountain now costs 1 additional token.
- Conquering Seas and Lakes is now forbidden.
smawg.basic_rules
module where you can still find basic rules from v0.12.0.
AbstractRules
now yield erros instead of raising.- Pre-existing
RulesViolation
subclasses for basic rules should now be imported fromsmawg.basic_rules
instead ofsmawg.default_rules
.
- Support for custom rules:
GameState
interface.AbstractRules
interface.- Reusable rule checker in
smawg.default_rules.Rules
. RulesT
parameter forGame.__init__
.--rules
option forsmawg.cli
.docs/rules.md
smawg.exceptions
module. Instead,- import
InvalidAssets
andRulesViolation
fromsmawg
. - import detailed
RulesViolation
subclasses fromsmawg.default_rules
.
- import
- Misleading
RulesViolation.MESSAGE
attribute.
Combo.base_n_tokens
ignoringRace.max_n_tokens
.
- Public symbols in
smawg
.
- Examples in documentation to use imports from
smawg
directly.
smawg.engine
(importsmawg
instead).shuffle()
androll_dice()
that shouldn't have been public.- Unused
Player.decline_ability
.
- Constructors of
Ability
,Race
andRegion
. - Parameters of
validate()
. - Speed up
Game
construction. - JSON schema now rejects negative tile indexes in
assets["map"]["tile_borders"]
. Game
constructor now validates tile borders, the number of races and the number of abilities, and may raiseInvalidAssets
exception.assets/tiny.json
now contains more races to pass the checks.
ABILITY_SCHEMA
,RACE_SCHEMA
,TILE_SCHEMA
andASSETS_SCHEMA
that shouldn't have been public.
- Unexpected crashes when assets contain too few races or abilities.
- Unexpected crashes when some map regions are not connected to the rest.
- Crashes or silent incorrect behaviour when map contains borders between non-existing tiles.
- Incorrect order of re-introducing races and abilities.
Game.regions
property.terrain
property for regions (which doesn't affect anything yet).validate()
function.smawg.viz
utility.
- Type annotations became stricter.
- Support for Python 3.9.
smawg.VERSION
constant that shouldn't have been public.
- Code examples in documentation.
- Impossible requirement to deploy tokens from hand when the player has no regions and has already used the dice.
smawg.exceptions
module with new exception subtypes.
RulesViolation
andGameEnded
are moved to the new module.smawg.engine
now throws more precise subtypes ofRulesViolation
instead of using it directly (but it still catches all cases as a base class).
- Lost Tribe tokens.
- The mechanic of abandoning regions.
- Related
Game
method:abandon()
. - Related
cli
command:abandon
.
- Reinforcements dice mechanic.
- Related
Game.conquer()
argument:use_dice
. - Related
Game
hook:"on_dice_rolled"
- Related
cli
command:conquer-dice
.
cli
error messages when given wrong number of arguments.
- Optional redeployment step at the end of the turn.
- Related
Game
method:start_redeployment()
. - Related
cli
command:redeploy
.
- Default
Game()
arguments are now keyword-only.
py.typed
marker for PEP 561 compliance.
- Dates of releases in
CHANGELOG.md
.
- Explicit
"n_coins_on_start"
in assets (instead of implicitly deduced from"n_combos"
). Game.player
as a shortcut toGame.players[Game.player_id]
.
- In assets, replaced
"min_n_players"
and"max_n_players"
with just"n_players"
. - Renamed
Game.current_player_id
toGame.player_id
.
n_players
parameter fromGame.__init__()
.--players
option fromcli
.
Game
potentially breaking whenassets
are modified later.cli
crashing whenshow-regions
argument is out of bounds.- "not enough values to unpack" when entering an empty line in
cli
.
- Schema and example of a
"map"
asset (without support for unique regions or Lost Tribes). - The mechanic of conquering regions and earning coins, but without:
- Reinforcements dice.
- Redeployment at the end of the turn.
- Ability to abandon regions.
- Related
Game
methods:conquer()
,deploy()
- Related
Game
hook:"on_redeploy"
- Related
Player
attributes:active_regions
,decline_regions
,tokens_on_hand
- Related
cli
commands:show-regions
,conquer
,deploy
. - Column "Tokens on hand" for
cli
commandshow-players
.
select_combo()
now validatescombo_index
and raisesValueError
.- More useful error message when attempting to
decline()
while already in Decline. - Tweaked
cli
error messages.
- Dead code related to tokens (including empty "public" class
Token
). Player
members that shouldn't have been public and got refactored out:- Methods
is_in_decline()
andneeds_to_pick_combo()
. - Attributes
acted_on_this_turn
anddeclined_on_this_turn
.
- Methods
- Validation of
"races"
and"abilities"
objects in asset files.
- JSON schema for asset files.
- A minimal asset file, which specifies:
- The number of players.
- The number of available race+ability combos.
- The number of turns.
- A list of races.
- A list of abilities.
smawg.engine
module withGame
class, which provides:- Methods for picking a combo and entering Decline.
- Properties for getting current stats.
- A mechanism for setting hooks on game events: start of turn, end of turn, end of game.
smawg.cli
client app, which provides a text-based interface for the library.- The ability to (sort of) play the game and lose if you don't pick the 0th combo!