feat(ai): add bumpiness

This commit is contained in:
Kristofers Solo 2024-01-09 20:27:56 +02:00
parent 76e306bd8a
commit 89884d7e2a

View File

@ -4,4 +4,13 @@ import numpy as np
def bumpiness(
field: np.ndarray[int, np.dtype[np.uint8]],
) -> int:
pass
"""
Calculate the bumpiness of a given signal based on peaks.
Args:
field: The game field.
Returns:
The bumpiness of the field.
"""
return int(np.sum(np.abs(np.diff(field.shape[0] - np.argmax(field, axis=0)))))