mirror of
https://github.com/kristoferssolo/Tetris.git
synced 2025-10-21 20:00:35 +00:00
feat(ai): add bumpiness
This commit is contained in:
parent
76e306bd8a
commit
89884d7e2a
@ -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)))))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user