mirror of
https://github.com/kristoferssolo/Tetris.git
synced 2025-10-21 20:00:35 +00:00
tests(ai): add heuristic tests
This commit is contained in:
parent
e4720c779d
commit
e3da29f62b
@ -1,6 +1,7 @@
|
|||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
from ai.heuristics import aggregate_height, bumpiness, complete_lines, holes
|
||||||
|
|
||||||
|
|
||||||
class TestHeuristics(unittest.TestCase):
|
class TestHeuristics(unittest.TestCase):
|
||||||
@ -15,3 +16,15 @@ class TestHeuristics(unittest.TestCase):
|
|||||||
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
|
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_aggregate_height(self) -> None:
|
||||||
|
self.assertEqual(aggregate_height(self.field), 48)
|
||||||
|
|
||||||
|
def test_complete_lines(self) -> None:
|
||||||
|
self.assertEqual(complete_lines(self.field), 2)
|
||||||
|
|
||||||
|
def test_holes(self) -> None:
|
||||||
|
self.assertEqual(holes(self.field), 2)
|
||||||
|
|
||||||
|
def test_bumpiness(self) -> None:
|
||||||
|
self.assertEqual(bumpiness(self.field), 6)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user