Skip to content

Commit

Permalink
Fix CI issues
Browse files Browse the repository at this point in the history
  • Loading branch information
relatko committed Feb 16, 2024
1 parent 2507d2d commit ec4d1a2
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 33 deletions.
4 changes: 3 additions & 1 deletion azul/bag.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ class Bag(TakeTilesFromBagInterface, StateInterface):
_tiles: List[Tile]

class RandomTakeInterface:
# pylint: disable=no-self-use
# pylint: disable=unused-argument
def take(self, count: int, tiles: List[Tile]) -> Tuple[List[Tile], List[Tile]]:
pass
assert False

class RandomTake(RandomTakeInterface):
_random: Random
Expand Down
8 changes: 4 additions & 4 deletions azul/final_points_calculation.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
class FinalPointsCalculation(FinalPointsCalculationInterface):
def get_points(self, wall: List[List[Optional[Tile]]]) -> Points:
assert len(wall) == 5
assert all([len(line) == 5 for line in wall])
row_points: int = sum([(2 if all(line) else 0) for line in wall])
assert all(len(line) == 5 for line in wall)
row_points: int = sum((2 if all(line) else 0) for line in wall)
transposed_wall = list(zip(*wall))
column_points: int = sum([(7 if all(line) else 0)
for line in transposed_wall])
column_points: int = sum((7 if all(line) else 0)
for line in transposed_wall)
color_points: int = 10 * \
len(set.intersection(
*[{tile for tile in line if tile} for line in wall]))
Expand Down
56 changes: 29 additions & 27 deletions azul/interfaces.py
Original file line number Diff line number Diff line change
@@ -1,119 +1,121 @@
# pylint: disable=no-self-use
# pylint: disable=unused-argument
from __future__ import annotations
from typing import List, Optional
from azul.simple_types import Tile, FinishRoundResult, Points


class GiveTilesInterface:
def give(self, tiles: List[Tile]) -> None:
pass
assert False


class TakeTilesFromBagInterface:
def take(self, count: int) -> List[Tile]:
pass
assert False


class StateInterface:
def state(self) -> str:
pass
assert False


class BagUsedTilesInterface(StateInterface):
def take_all(self) -> List[Tile]:
pass
assert False


class TileSourceInterface:
def take(self, idx: int) -> List[Tile]:
pass
assert False

def is_empty(self) -> bool:
pass
assert False

def start_new_round(self) -> None:
pass
assert False

def state(self) -> str:
pass
assert False


class GameInterface:
def start_game(self) -> None:
pass
assert False

def take(self, player_id: int, source_idx: int, idx: int, destination_idx: int) -> bool:
pass
assert False


class TableAreaInterface(StateInterface):
def take(self, source_idx: int, idx: int) -> List[Tile]:
pass
assert False

def is_round_end(self) -> bool:
pass
assert False

def start_new_round(self) -> None:
pass
assert False


class BoardInterface(StateInterface):
def put(self, destination_idx: int, tiles: List[Tile]) -> None:
pass
assert False

def finish_round(self) -> FinishRoundResult:
pass
assert False

def end_game(self) -> None:
pass
assert False


class NotifyEverybodyInterface:
def notify_everybody(self, state: str) -> None:
pass
assert False


class FloorInterface(StateInterface, GiveTilesInterface):
def finish_round(self) -> Points:
pass
assert False


class PatternLineWallLineInterface:
def can_put_tile(self, tile: Tile) -> bool:
pass
assert False

def put_tile(self, tile: Tile) -> Points:
pass
assert False


class ObserverInterface:
def notify(self, new_state: str) -> None:
pass
assert False


class ObservableInterface:
def register_observer(self, observer: ObserverInterface) -> None:
pass
assert False

def cancel_observer(self, observer: ObserverInterface) -> None:
pass
assert False


class FinalPointsCalculationInterface:
def get_points(self, wall: List[List[Optional[Tile]]]) -> Points:
pass
assert False


class GameFinishedInterface:
def game_finished(self, wall: List[List[Optional[Tile]]]) -> FinishRoundResult:
pass
assert False


class WallLineInterface(StateInterface):
@property
def tiles(self) -> List[Optional[Tile]]:
pass
assert False


class PatternLineInterface(StateInterface, GiveTilesInterface):
def finish_round(self) -> Points:
pass
assert False
2 changes: 1 addition & 1 deletion azul/pattern_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def give(self, tiles: List[Tile]) -> None:
# Check if tiles are all of the same type
if not tiles:
return
assert all([tile == tiles[0] for tile in tiles])
assert all(tile == tiles[0] for tile in tiles)

assert self._capacity >= len(self._tiles)
count_to_fit = min(self._capacity - len(self._tiles), len(tiles))
Expand Down

0 comments on commit ec4d1a2

Please sign in to comment.