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 49c69bf
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 36 deletions.
3 changes: 2 additions & 1 deletion azul/bag.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ class Bag(TakeTilesFromBagInterface, StateInterface):
_tiles: List[Tile]

class RandomTakeInterface:
# 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
55 changes: 28 additions & 27 deletions azul/interfaces.py
Original file line number Diff line number Diff line change
@@ -1,119 +1,120 @@
# 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
3 changes: 0 additions & 3 deletions test/test_final_points_calculation.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ def setUp(self) -> None:

def test_get_points(self) -> None:
test_wall: List[List[Optional[Tile]]] = [
# pylint: disable=bad-whitespace
[None, YELLOW, RED, None, None],
[None, BLUE, YELLOW, RED, None],
[None, GREEN, BLUE, None, RED],
Expand All @@ -25,7 +24,6 @@ def test_get_points(self) -> None:

def test_get_points2(self) -> None:
test_wall: List[List[Optional[Tile]]] = [
# pylint: disable=bad-whitespace
[BLUE, YELLOW, RED, BLACK, GREEN],
[GREEN, BLUE, YELLOW, RED, BLACK],
[BLACK, GREEN, BLUE, YELLOW, RED],
Expand All @@ -38,7 +36,6 @@ def test_get_points2(self) -> None:

def test_get_points3(self) -> None:
test_wall: List[List[Optional[Tile]]] = [
# pylint: disable=bad-whitespace
[BLUE, None, RED, BLACK, GREEN],
[GREEN, BLUE, YELLOW, None, BLACK],
[BLACK, GREEN, None, YELLOW, RED],
Expand Down

0 comments on commit 49c69bf

Please sign in to comment.