15 lines
540 B
Python
15 lines
540 B
Python
import numpy as np
|
|
|
|
def random_property_rotation(
|
|
user_keypad: np.ndarray,
|
|
prop_rotation: list[int]
|
|
) -> np.ndarray:
|
|
transposed = user_keypad.T
|
|
if len(prop_rotation) != len(transposed):
|
|
raise ValueError("prop_rotation must be the same length as the number of properties")
|
|
for idx, prop_set in enumerate(transposed):
|
|
rotation = prop_rotation[idx]
|
|
rotation = rotation % len(prop_set) if len(prop_set) > 0 else 0
|
|
transposed[idx] = np.roll(prop_set, rotation)
|
|
return transposed.T
|