Skip to content

Commit

Permalink
sudoku
Browse files Browse the repository at this point in the history
  • Loading branch information
Hakan authored and Hakan committed Jul 19, 2020
1 parent cfe50ed commit ff15401
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions 030_sudoku.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,27 @@
[2, 8, 7, 4, 1, 9, 6, 3, 5],
[3, 0, 0, 4, 8, 1, 1, 7, 9]]

# def valid_solution(board):
# dik = [list(map(lambda x:x[a],board)) for a in range(len(board))]
def valid_solution(board):
dik = [list(map(lambda x:x[a],board)) for a in range(len(board))]

# dik = []
# for a in range(len(board))
# dik.extend(list(map(lambda x:x[a],board)))
# k_dokuz=[list(map(lambda x:x[i:i+3],board[k:k+3])) for i in range(0,9,3) for k in range(0,9,3)]
# dik.extend(list(map(lambda x:x[a],board)))

k_dokuz=[list(map(lambda x:x[i:i+3],board[k:k+3])) for i in range(0,9,3)\
for k in range(0,9,3)]

# k_dokuz = []
# for k in range(0,9,3):
# for i in range(0,9,3):
# k_dokuz.extend(list(map(lambda x:x[i:i+3],board[k:k+3])))
# k_dokuz= [i[0]+i[1]+i[2] for i in k_dokuz]
# y_k_dokuz = []
# for i in k_dokuz:
# y_k_dokuz += [i[0]+i[1]+i[2]]

# k_dokuz.extend(list(map(lambda x:x[i:i+3],board[k:k+3])))

def valid_solution(board):
dik = [list(map(lambda x:x[a],board)) for a in range(len(board))]
k_dokuz=[list(map(lambda x:x[i:i+3],board[k:k+3])) for i in range(0,9,3)\
for k in range(0,9,3)]
k_dokuz= [i[0]+i[1]+i[2] for i in k_dokuz]

# y_k_dokuz = []
# for i in k_dokuz:
# y_k_dokuz += [i[0]+i[1]+i[2]]

for i in board,dik,k_dokuz:
for k in i:
if set(k)!={1,2,3,4,5,6,7,8,9}:
Expand Down

0 comments on commit ff15401

Please sign in to comment.