mirror of
https://github.com/kristoferssolo/Tetris.git
synced 2025-10-21 20:00:35 +00:00
21 lines
565 B
Python
21 lines
565 B
Python
import unittest
|
|
|
|
import numpy as np
|
|
from ai.moves.height import aggregate_height
|
|
|
|
|
|
class TestFitness(unittest.TestCase):
|
|
def test_aggregate_height(self):
|
|
field = np.array(
|
|
[
|
|
[0, 0, 0, 0, 1, 1, 0, 0, 0, 0],
|
|
[0, 1, 1, 1, 1, 1, 1, 0, 0, 1],
|
|
[0, 1, 1, 0, 1, 1, 1, 1, 1, 1],
|
|
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
|
|
[1, 1, 1, 0, 1, 1, 1, 1, 1, 1],
|
|
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
|
|
]
|
|
)
|
|
|
|
self.assertEqual(aggregate_height(field), 48)
|