Skip to content

Commit

Permalink
Fixed meeple counts and removed unused imports.
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentbons committed May 18, 2020
1 parent 28b6907 commit 63d6430
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
16 changes: 8 additions & 8 deletions examples/four_player_game_random_moves.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,24 @@ def print_state(carcassonne_game_state: CarcassonneGameState):
},
"meeples": {
"player 1": {
"normal": str(carcassonne_game_state.meeples[0]) + " / " + str(carcassonne_game_state.meeples[0] + len(list(filter(lambda x: x.meeple_type == MeepleType.NORMAL, game.state.placed_meeples[0])))),
"normal": str(carcassonne_game_state.meeples[0]) + " / " + str(carcassonne_game_state.meeples[0] + len(list(filter(lambda x: x.meeple_type == MeepleType.NORMAL or x.meeple_type == MeepleType.FARMER, game.state.placed_meeples[0])))),
"abbots": str(carcassonne_game_state.abbots[0]) + " / " + str(carcassonne_game_state.abbots[0] + len(list(filter(lambda x: x.meeple_type == MeepleType.ABBOT, game.state.placed_meeples[0])))),
"big": str(carcassonne_game_state.big_meeples[0]) + " / " + str(carcassonne_game_state.big_meeples[0] + len(list(filter(lambda x: x.meeple_type == MeepleType.BIG, game.state.placed_meeples[0]))))
"big": str(carcassonne_game_state.big_meeples[0]) + " / " + str(carcassonne_game_state.big_meeples[0] + len(list(filter(lambda x: x.meeple_type == MeepleType.BIG or x.meeple_type == MeepleType.BIG_FARMER, game.state.placed_meeples[0]))))
},
"player 2": {
"normal": str(carcassonne_game_state.meeples[1]) + " / " + str(carcassonne_game_state.meeples[1] + len(list(filter(lambda x: x.meeple_type == MeepleType.NORMAL, game.state.placed_meeples[1])))),
"normal": str(carcassonne_game_state.meeples[1]) + " / " + str(carcassonne_game_state.meeples[1] + len(list(filter(lambda x: x.meeple_type == MeepleType.NORMAL or x.meeple_type == MeepleType.FARMER, game.state.placed_meeples[1])))),
"abbots": str(carcassonne_game_state.abbots[1]) + " / " + str(carcassonne_game_state.abbots[1] + len(list(filter(lambda x: x.meeple_type == MeepleType.ABBOT, game.state.placed_meeples[1])))),
"big": str(carcassonne_game_state.big_meeples[1]) + " / " + str(carcassonne_game_state.big_meeples[1] + len(list(filter(lambda x: x.meeple_type == MeepleType.BIG, game.state.placed_meeples[1]))))
"big": str(carcassonne_game_state.big_meeples[1]) + " / " + str(carcassonne_game_state.big_meeples[1] + len(list(filter(lambda x: x.meeple_type == MeepleType.BIG or x.meeple_type == MeepleType.BIG_FARMER, game.state.placed_meeples[1]))))
},
"player 3": {
"normal": str(carcassonne_game_state.meeples[2]) + " / " + str(carcassonne_game_state.meeples[2] + len(list(filter(lambda x: x.meeple_type == MeepleType.NORMAL, game.state.placed_meeples[2])))),
"normal": str(carcassonne_game_state.meeples[2]) + " / " + str(carcassonne_game_state.meeples[2] + len(list(filter(lambda x: x.meeple_type == MeepleType.NORMAL or x.meeple_type == MeepleType.FARMER, game.state.placed_meeples[2])))),
"abbots": str(carcassonne_game_state.abbots[2]) + " / " + str(carcassonne_game_state.abbots[2] + len(list(filter(lambda x: x.meeple_type == MeepleType.ABBOT, game.state.placed_meeples[2])))),
"big": str(carcassonne_game_state.big_meeples[2]) + " / " + str(carcassonne_game_state.big_meeples[2] + len(list(filter(lambda x: x.meeple_type == MeepleType.BIG, game.state.placed_meeples[2]))))
"big": str(carcassonne_game_state.big_meeples[2]) + " / " + str(carcassonne_game_state.big_meeples[2] + len(list(filter(lambda x: x.meeple_type == MeepleType.BIG or x.meeple_type == MeepleType.BIG_FARMER, game.state.placed_meeples[2]))))
},
"player 4": {
"normal": str(carcassonne_game_state.meeples[3]) + " / " + str(carcassonne_game_state.meeples[3] + len(list(filter(lambda x: x.meeple_type == MeepleType.NORMAL, game.state.placed_meeples[3])))),
"normal": str(carcassonne_game_state.meeples[3]) + " / " + str(carcassonne_game_state.meeples[3] + len(list(filter(lambda x: x.meeple_type == MeepleType.NORMAL or x.meeple_type == MeepleType.FARMER, game.state.placed_meeples[3])))),
"abbots": str(carcassonne_game_state.abbots[3]) + " / " + str(carcassonne_game_state.abbots[3] + len(list(filter(lambda x: x.meeple_type == MeepleType.ABBOT, game.state.placed_meeples[3])))),
"big": str(carcassonne_game_state.big_meeples[3]) + " / " + str(carcassonne_game_state.big_meeples[3] + len(list(filter(lambda x: x.meeple_type == MeepleType.BIG, game.state.placed_meeples[3]))))
"big": str(carcassonne_game_state.big_meeples[3]) + " / " + str(carcassonne_game_state.big_meeples[3] + len(list(filter(lambda x: x.meeple_type == MeepleType.BIG or x.meeple_type == MeepleType.BIG_FARMER, game.state.placed_meeples[3]))))
}
}
}
Expand Down
9 changes: 4 additions & 5 deletions examples/two_player_game_random_moves.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ def print_state(carcassonne_game_state: CarcassonneGameState):
},
"meeples": {
"player 1": {
"normal": str(carcassonne_game_state.meeples[0]) + " / " + str(carcassonne_game_state.meeples[0] + len(list(filter(lambda x: x.meeple_type == MeepleType.NORMAL, game.state.placed_meeples[0])))),
"normal": str(carcassonne_game_state.meeples[0]) + " / " + str(carcassonne_game_state.meeples[0] + len(list(filter(lambda x: x.meeple_type == MeepleType.NORMAL or x.meeple_type == MeepleType.FARMER, game.state.placed_meeples[0])))),
"abbots": str(carcassonne_game_state.abbots[0]) + " / " + str(carcassonne_game_state.abbots[0] + len(list(filter(lambda x: x.meeple_type == MeepleType.ABBOT, game.state.placed_meeples[0])))),
"big": str(carcassonne_game_state.big_meeples[0]) + " / " + str(carcassonne_game_state.big_meeples[0] + len(list(filter(lambda x: x.meeple_type == MeepleType.BIG, game.state.placed_meeples[0]))))
"big": str(carcassonne_game_state.big_meeples[0]) + " / " + str(carcassonne_game_state.big_meeples[0] + len(list(filter(lambda x: x.meeple_type == MeepleType.BIG or x.meeple_type == MeepleType.BIG_FARMER, game.state.placed_meeples[0]))))
},
"player 2": {
"normal": str(carcassonne_game_state.meeples[1]) + " / " + str(carcassonne_game_state.meeples[1] + len(list(filter(lambda x: x.meeple_type == MeepleType.NORMAL, game.state.placed_meeples[1])))),
"normal": str(carcassonne_game_state.meeples[1]) + " / " + str(carcassonne_game_state.meeples[1] + len(list(filter(lambda x: x.meeple_type == MeepleType.NORMAL or x.meeple_type == MeepleType.FARMER, game.state.placed_meeples[1])))),
"abbots": str(carcassonne_game_state.abbots[1]) + " / " + str(carcassonne_game_state.abbots[1] + len(list(filter(lambda x: x.meeple_type == MeepleType.ABBOT, game.state.placed_meeples[1])))),
"big": str(carcassonne_game_state.big_meeples[1]) + " / " + str(carcassonne_game_state.big_meeples[1] + len(list(filter(lambda x: x.meeple_type == MeepleType.BIG, game.state.placed_meeples[1]))))
"big": str(carcassonne_game_state.big_meeples[1]) + " / " + str(carcassonne_game_state.big_meeples[1] + len(list(filter(lambda x: x.meeple_type == MeepleType.BIG or x.meeple_type == MeepleType.BIG_FARMER, game.state.placed_meeples[1]))))
}
}
}
Expand All @@ -43,6 +43,5 @@ def print_state(carcassonne_game_state: CarcassonneGameState):
if action is not None:
game.step(player, action)
game.render()
i = 0

print_state(carcassonne_game_state=game.state)
2 changes: 0 additions & 2 deletions test/meeple_util_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@

from main.carcassonne_game_state import CarcassonneGameState
from main.tile_sets.base_deck import base_tiles
from main.objects.city import City
from main.objects.coordinate import Coordinate
from main.objects.coordinate_with_side import CoordinateWithSide
from main.objects.meeple_position import MeeplePosition
from main.objects.meeple_type import MeepleType
from main.objects.side import Side
from main.utils.city_util import CityUtil
from main.utils.meeple_util import MeepleUtil


Expand Down

0 comments on commit 63d6430

Please sign in to comment.