Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix resolving --strict value #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def prepare_settings():
parser.add_argument("--games", metavar="GAMES", default="games.pgn",
help="A specific pgn with games")
parser.add_argument("--strict", metavar="STRICT", default=True,
type=str2bool, const=True, nargs="?",
help="If False then it will be generate more tactics but maybe a little ambiguous")
parser.add_argument("--includeBlunder", metavar="INCLUDE_BLUNDER", default=True,
type=str2bool, const=True, dest="include_blunder", nargs="?",
Expand Down
5 changes: 3 additions & 2 deletions modules/puzzle/position_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,14 @@ def is_complete(self, category, color, first_node, first_val):
return False

def ambiguous(self):
# If strict == False then it will generate more tactics but more ambiguous
# If strict == False then it will generate more tactics but more ambiguous
move_number = 1 if self.strict else 2
if len(self.analysed_legals) > 1:
if (self.analysed_legals[0].evaluation.cp is not None
and self.analysed_legals[1].evaluation.cp is not None):
if (self.analysed_legals[0].evaluation.cp > -210
or self.analysed_legals[move_number].evaluation.cp < -90):
or (len(self.analysed_legals) >= move_number
and self.analysed_legals[move_number].evaluation.cp < -90)):
return True
if (self.analysed_legals[0].evaluation.mate is not None
and self.analysed_legals[1].evaluation.mate is not None):
Expand Down