mirror of
https://github.com/kristoferssolo/Tetris.git
synced 2025-10-21 20:00:35 +00:00
feat(ai): add aggregate_height
This commit is contained in:
parent
89884d7e2a
commit
9daa4f6509
@ -2,4 +2,13 @@ import numpy as np
|
|||||||
|
|
||||||
|
|
||||||
def aggregate_height(field: np.ndarray[int, np.dtype[np.uint8]]) -> int:
|
def aggregate_height(field: np.ndarray[int, np.dtype[np.uint8]]) -> int:
|
||||||
return 0
|
"""
|
||||||
|
Calculates the aggregate height of the field.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
field: 2D array representing the game field.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
The aggregate height of the field.
|
||||||
|
"""
|
||||||
|
return int(np.sum(field.shape[0] - np.argmax(field, axis=0)))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user