diff --git a/sources/grid.py b/sources/grid.py index 3702590..75e4e46 100644 --- a/sources/grid.py +++ b/sources/grid.py @@ -66,43 +66,30 @@ class Grid: v_next = square.next_vert() h_prev = square.prev_horiz() h_next = square.next_horiz() - # print("Taking care of {}".format(square)) + if not square.switched and v_prev and v_prev.state != ' ': - # print("On vérifie le précédent vertical.") v_p_prev = v_prev.prev_vert() if v_p_prev and v_p_prev.state == v_prev.state: square.state = v_prev.opposite_state() - # print("Square {} switched to {}".format(square, - # square.state)) elif v_next and v_next.state == v_prev.state: square.state = v_prev.opposite_state() - # print("Square {} switched to {}".format(square, - # square.state)) + if not square.switched and v_next and v_next.state != ' ': - # print("On vérifie le suivant vertical.") v_n_next = v_next.next_vert() if v_n_next and v_n_next.state == v_next.state: square.state = v_next.opposite_state() - # print("Square {} switched to {}".format(square, - # square.state)) + if not square.switched and h_prev and h_prev.state != ' ': - # print("On vérifie le précédent horizontal.") h_p_prev = h_prev.prev_horiz() if h_p_prev and h_p_prev.state == h_prev.state: square.state = h_prev.opposite_state() - # print("Square {} switched to {}".format(square, - # square.state)) elif h_next and h_next.state == h_prev.state: square.state = h_prev.opposite_state() - # print("Square {} switched to {}".format(square, - # square.state)) + if not square.switched and h_next and h_next.state != ' ': - # print("On vérifie le suivant horizontal.") h_n_next = h_next.next_horiz() if h_n_next and h_n_next.state == h_next.state: square.state = h_next.opposite_state() - # print("Square {} switched to {}".format(square, - # square.state)) class Square: