17 def __init__(self, opening_book: Literal[
"default",
"8-ply",
"12-ply",
"12-ply-dist"] |
None =
"default") ->
None:
18 """Initializes the BitBully agent with the specified opening book.
21 opening_book (Literal["default", "8-ply", "12-ply", "12-ply-dist"] | None):
22 The type of opening book to use. Options are:
23 - "default": Uses the default 12-ply distance-based opening book.
24 - "8-ply": Uses an 8-ply opening book.
25 - "12-ply": Uses a 12-ply opening book.
26 - "12-ply-dist": Uses a 12-ply distance-based opening book.
27 - None: No opening book will be used.
31 db_path: Traversable | str |
None =
None
32 if opening_book ==
"default":
33 db_path = importlib.resources.files(
"bitbully").joinpath(
"assets/book_12ply_distances.dat")
34 elif opening_book ==
"8-ply":
35 db_path = importlib.resources.files(
"bitbully").joinpath(
"assets/book_8ply.dat")
36 elif opening_book ==
"12-ply":
37 db_path = importlib.resources.files(
"bitbully").joinpath(
"assets/book_12ply.dat")
38 elif opening_book ==
"12-ply-dist":
39 db_path = importlib.resources.files(
"bitbully").joinpath(
"assets/book_12ply_distances.dat")
42 self.
bitbully_agent = bitbully_core.BitBullyCore(pathlib.Path(str(db_path)))