From 5c0d07ba15ee82d2acf3e5201ad65b6c800b7b3d Mon Sep 17 00:00:00 2001 From: Kristofers Solo Date: Tue, 9 Jan 2024 20:29:16 +0200 Subject: [PATCH] feat(ai): add `complete_lines` --- src/ai/heuristics/lines.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/ai/heuristics/lines.py b/src/ai/heuristics/lines.py index d1285e7..01d9061 100644 --- a/src/ai/heuristics/lines.py +++ b/src/ai/heuristics/lines.py @@ -2,4 +2,13 @@ import numpy as np def complete_lines(field: np.ndarray[int, np.dtype[np.uint8]]) -> int: - return 0 + """ + Calculates the number of complete lines in the field. + + Args: + field: 2D array representing the game field. + + Returns: + The number of complete lines in the field. + """ + return int(np.sum(np.all(field, axis=1)))