mirror of
https://github.com/kristoferssolo/Tetris.git
synced 2026-03-22 00:36:20 +00:00
feat(ai): add aggregate height calculation
This commit is contained in:
20
tests/ai/test_moves.py
Normal file
20
tests/ai/test_moves.py
Normal file
@@ -0,0 +1,20 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user