diff --git a/server/crossword.py b/server/crossword.py index ece4bc9..81b65bc 100644 --- a/server/crossword.py +++ b/server/crossword.py @@ -213,7 +213,36 @@ class Grid(object): return status_update def check_and_reveal_word(self, x: int, y: int): - return self.check_and_reveal_horizontal(x, y) + self.check_and_reveal_vertival(x, y) + grid_update = self.check_and_reveal_horizontal(x, y) + self.check_and_reveal_vertival(x, y) + + # check also the solution locations + + is_solution_cell = False + for location in self._solution_locations: + ly = location[0] + lx = location[1] + + if lx == x and ly == y: + is_solution_cell = True + cell = self._grid[ly][lx] + if cell.get_user_content() != cell.get_content(): + # not solved, nothing to do, return only grid update + return grid_update + + if not is_solution_cell: + return grid_update + + solution_updates = [] + for location in self._solution_locations: + ly = location[0] + lx = location[1] + + solution_updates.append({ + 'x': lx, + 'y': ly, + 'revealed': self._grid[ly][lx].get_content() + }) + return grid_update + solution_updates def user_input(self, x: int, y: int, letter: str) -> list: assert len(letter) <= 1 diff --git a/server/de.json b/server/de.json index 85c1f01..495b7a1 100644 --- a/server/de.json +++ b/server/de.json @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5c043827e36783046fc91cf069cc7e60d580f2a666bc0f0f002a3f9c73ce7915 -size 22199093 +oid sha256:6de1aef976ef47d0a63766772a1d350c24629b9651e2f447aee11dbd56f3186f +size 26924812