Skip to content

Commit

Permalink
Version 1.0.4 Bugfix collecting points for chapel or flowers. Add sup…
Browse files Browse the repository at this point in the history
…plementary rule that allows for normal meeples to use flowers. Dependency upgrades.
  • Loading branch information
vincentbons committed Oct 14, 2021
1 parent 8145673 commit d7ce099
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
numpy==1.21.1
Pillow==8.3.1
numpy==1.21.2
Pillow==8.3.2
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from setuptools import setup, find_namespace_packages

setup(name='wingedsheep-carcassonne',
version='1.0.3',
version='1.0.4',
description='Carcassonne implementation',
author='Vincent Bons',
url='https://github.com/wingedsheep/carcassonne',
download_url='https://github.com/wingedsheep/carcassonne',
license='MIT',
install_requires=['numpy>=1.21.1',
'pillow>=8.3.1'],
install_requires=['numpy>=1.21.2',
'pillow>=8.3.2'],
packages=find_namespace_packages(),
package_data={"": ["*.png", "*.jpg"]})
1 change: 1 addition & 0 deletions wingedsheep/carcassonne/tile_sets/supplementary_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
class SupplementaryRule(Enum):
FARMERS = "farmers"
ABBOTS = "abbots"
NORMAL_MEEPLES_CAN_USE_FLOWERS = "normal_meeples_can_use_flowers"

def to_json(self):
return self.value
Expand Down
5 changes: 4 additions & 1 deletion wingedsheep/carcassonne/utils/points_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ def remove_meeples_and_collect_points(cls, game_state: CarcassonneGameState, coo
meeples_per_player = []
for _ in range(game_state.players):
meeples_per_player.append([])
meeples_per_player[meeple_of_player].append(coordinate_with_side)

for meeple_position in game_state.placed_meeples[meeple_of_player]:
if coordinate_with_side == meeple_position.coordinate_with_side:
meeples_per_player[meeple_of_player].append(meeple_position)

MeepleUtil.remove_meeples(game_state=game_state, meeples=meeples_per_player)

Expand Down
4 changes: 4 additions & 0 deletions wingedsheep/carcassonne/utils/possible_move_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ def __possible_meeple_positions(game_state: CarcassonneGameState) -> [Coordinate
if last_played_tile.chapel:
playing_positions.append(CoordinateWithSide(coordinate=last_played_position, side=Side.CENTER))

if last_played_tile.flowers \
and SupplementaryRule.NORMAL_MEEPLES_CAN_USE_FLOWERS in game_state.supplementary_rules:
playing_positions.append(CoordinateWithSide(coordinate=last_played_position, side=Side.CENTER))

for side in [Side.TOP, Side.RIGHT, Side.BOTTOM, Side.LEFT]:
if last_played_tile.get_type(side) == TerrainType.CITY:
connected_cities = CityUtil.find_city(
Expand Down

0 comments on commit d7ce099

Please sign in to comment.