Skip to content

Commit

Permalink
Adds a 'NotProvided' solution state to the SolutionState enum (#29)
Browse files Browse the repository at this point in the history
This is not well documented but one of the values in the SolutionState bit at 0x32 is 0x0002, which indicates that the solution is not present in the file. In practice I think almost every client treats it just about the same as 0x0004 in that spot (suppressing or disabling "reveal" tools) but it may be the case that some clients will correctly not offer an attempt to unscramble either.
  • Loading branch information
thisisparker authored Jun 12, 2024
1 parent fe79465 commit 6083384
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion puz.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ def enum(**enums):
SolutionState = enum(
# solution is available in plaintext
Unlocked=0x0000,
# solution is not present in the file
NotProvided=0x0002,
# solution is locked (scrambled) with a key
Locked=0x0004
)
Expand Down Expand Up @@ -319,7 +321,7 @@ def blacksquare(self):
return BLACKSQUARE2 if self.puzzletype == PuzzleType.Diagramless else BLACKSQUARE

def is_solution_locked(self):
return bool(self.solution_state != SolutionState.Unlocked)
return bool(self.solution_state == SolutionState.Locked)

def unlock_solution(self, key):
if self.is_solution_locked():
Expand Down

0 comments on commit 6083384

Please sign in to comment.