99import logging
1010import sys
1111
12+ from typing import Type
13+
1214import chess
1315import chess .engine
1416import chess .variant
1517
1618
17- async def test_epd (engine , epd , VariantBoard , movetime ) :
19+ async def test_epd (engine : chess . engine . EngineProtocol , epd : str , VariantBoard : Type [ chess . Board ] , movetime : float ) -> float :
1820 board , epd_info = VariantBoard .from_epd (epd )
1921 epd_string = epd_info .get ("id" , board .fen ())
2022 if "am" in epd_info :
@@ -25,7 +27,10 @@ async def test_epd(engine, epd, VariantBoard, movetime):
2527 limit = chess .engine .Limit (time = movetime )
2628 result = await engine .play (board , limit , game = object ())
2729
28- if "am" in epd_info and result .move in epd_info ["am" ]:
30+ if not result .move :
31+ print (f"{ epd_string } : -- | +0" )
32+ return 0.0
33+ elif "am" in epd_info and result .move in epd_info ["am" ]:
2934 print (f"{ epd_string } : { board .san (result .move )} | +0" )
3035 return 0.0
3136 elif "bm" in epd_info and result .move not in epd_info ["bm" ]:
@@ -36,7 +41,7 @@ async def test_epd(engine, epd, VariantBoard, movetime):
3641 return 1.0
3742
3843
39- async def test_epd_with_fractional_scores (engine , epd , VariantBoard , movetime ) :
44+ async def test_epd_with_fractional_scores (engine : chess . engine . EngineProtocol , epd : str , VariantBoard : Type [ chess . Board ] , movetime : float ) -> float :
4045 board , epd_info = VariantBoard .from_epd (epd )
4146 epd_string = epd_info .get ("id" , board .fen ())
4247 if "am" in epd_info :
@@ -71,7 +76,7 @@ async def test_epd_with_fractional_scores(engine, epd, VariantBoard, movetime):
7176 return score
7277
7378
74- async def main ():
79+ async def main () -> None :
7580 # Parse command line arguments.
7681 parser = argparse .ArgumentParser (description = __doc__ )
7782
0 commit comments