Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def attempt_to_plot_value(board_, i, j):
- cell_values = get_cell_values(board_, get_cell_row(i), get_cell_column(j))
- seen_numbers = []
- possible_numbers = []
- # Looks for numbers that are set horizontally
- for x in range(0, 6):
- current_cell = board_[i][x]
- if current_cell != 0:
- seen_numbers.append(current_cell)
- # Looks for numbers that are set vertical
- for y in range(0, 6):
- current_cell = board_[y][j]
- if current_cell != 0:
- seen_numbers.append(current_cell)
- # For all numbers 1-6, if the number does not exist horizontally or vertically,
- # and the current grid does not contain the value, add the number as a possible candidate
- for z in range(1, 7):
- if z not in seen_numbers and z not in cell_values:
- possible_numbers.append(z)
- # if it's just a candidate, "assign" the number to the cell
- if len(possible_numbers) == 1:
- board_[i][j] = possible_numbers[0]
- return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement