Farih.co.id
Home Programming Cara Buat Pemecah Sudoku dengan Python

Cara Buat Pemecah Sudoku dengan Python

Di dalam skrip Python baru bernama sudoku.py, simpan semua nilai untuk kisi 9×9. Setiap baris dan kolom mewakili sembilan angka di sepanjang dan di bawah teka-teki Sudoku. Tambahkan 0 untuk mewakili ruang yang perlu dipecahkan:

 board = [
  [5, 3, 0, 0, 7, 0, 0, 0, 0],
  [6, 0, 0, 1, 9, 5, 0, 0, 0],
  [0, 9, 8, 0, 0, 0, 0, 6, 0],
  [8, 0, 0, 0, 6, 0, 0, 0, 3],
  [4, 0, 0, 8, 0, 3, 0, 0, 1],
  [7, 0, 0, 0, 2, 0, 0, 0, 6],
  [0, 6, 0, 0, 0, 0, 2, 8, 0],
  [0, 0, 0, 4, 1, 9, 0, 0, 5],
  [0, 0, 0, 0, 8, 0, 0, 7, 9]
]

Comment
Share:

Leave a Reply

Your email address will not be published. Required fields are marked *

https://167.71.217.241/ https://188.166.210.27/ https://103.253.147.8/ https://139.59.194.132/ https://152.42.192.54/ https://152.42.187.123/ https://188.166.196.248/ https://163.47.9.78/ https://157.230.245.144/ http://68.183.96.87/ http://147.182.210.122/ http://147.182.128.234/ http://167.172.1.184/ http://157.245.5.74/ http://139.59.217.59/ http://163.47.9.16/ http://144.126.251.215/ http://139.59.217.128/ http://103.186.0.254/ http://161.35.251.176/ http://157.245.29.71/ https://170.64.254.102/ https://www.markas303.ac.id/ https://www.markas303.or.id/ https://www.markas303.sch.id/ http://103.172.205.75/ http://103.245.38.119/ http://138.197.224.231/ http://138.197.224.231/

Ad