From c884800066cf15c09fd43e2ed40adbb5cbea0e13 Mon Sep 17 00:00:00 2001 From: Asaf Kali <akali93@gmail.com> Date: Sat, 30 Sep 2023 20:46:19 +0300 Subject: [PATCH] Naive hinter fix - handle case where no Gray cards are on the board. --- pyproject.toml | 2 +- solvers/naive/naive_hinter.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index e75f265..152078c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ [tool.poetry] name = "codenames-solvers" -version = "1.4.9" +version = "1.4.10" description = "Solvers implementation for Codenames board game in python." authors = ["Asaf Kali <akali93@gmail.com>"] readme = "README.md" diff --git a/solvers/naive/naive_hinter.py b/solvers/naive/naive_hinter.py index 4458e65..997d3e1 100644 --- a/solvers/naive/naive_hinter.py +++ b/solvers/naive/naive_hinter.py @@ -241,7 +241,7 @@ def proposal_from_similarity( hint_word=self.board_format(hint), hint_word_frequency=self.get_word_frequency(hint), distance_group=np.max(hint_to_group), - distance_gray=np.min(hint_to_gray), + distance_gray=np.min(hint_to_gray) if hint_to_gray.size > 0 else 1, distance_opponent=np.min(hint_to_opponent), distance_black=np.min(hint_to_black), board_distances=self._get_board_distances_dict(board_distances),