Ad
  • Custom User Avatar
  • Custom User Avatar

    Generating test data with only integer solutions is easy enough, you just start by deciding the results and building your system of equations off of that. The description also implies that this is how tests are generated.

  • Custom User Avatar

    I just tested some solutions, and they pass consistently below 10 seconds.

  • Custom User Avatar

    This doesn't occur anymore. Maybe there was a flaw in some old version, but with Python 3.10 it's fine.

  • Custom User Avatar

    I haven't finished the challenge yet but i can say that your alternative solution not consider that you can open the "constants". One example of this is:

    realSolution[0][3] = 1
    yourSolution[0][3] = 2

    depending if hidden number is 1 or 2 you can determinate where is the mine.
    You can know that this square can be opened becouse in the two options the square is a number (no can be explode)

    (I am sorry if it is not well understood. My english is not good)

  • Custom User Avatar

    regarding the test output, yes it indeed seems there was a mistake there, since the check_solution function modified the grid. fixed, thanks!
    As for your solution, it seems to be indeed false. I created a fork of the interactive version to display this grid: https://openprocessing.org/sketch/1540470, the issue should become clear then.

    I am not testing for a certain solution, i just verify if the given solution works.
    Here's what's in preloaded:

    def _cross_indices(x, y, w, h):
            return {(i, y) for i in range(w)}.union({(x, i) for i in range(h)})
    def _toggle(grid, x, y):
        for ix, iy in _cross_indices(x, y, len(grid[0]), len(grid)):
            grid[iy][ix] ^= 1
    def check_solution(grid, solution):
        grid = copy.deepcopy(grid)
        for x, y in solution:
            _toggle(grid, x, y)
        return all(all(val == 1 for val in row) for row in grid)
    
  • Custom User Avatar

    Hmmm now I cant remember if the kata used integers as solution from the very beginning, or I made it like this. I will check, and add an apropriate note to the description if necessary. I think I could hope this would be covered by "All coefficients are integers [...]", but can't remember exactly now.

  • Default User Avatar

    You need iterative version for the important function to pass this kata.