Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trouble with Sudoku Solver
#3
Thankyou so much Mateusz! That was exactly what I was looking for! From here I can find out which square the requested cell is in, and just return the result of that square.

The code for each square's contents as expanded from Mateusz's code:
sq1 = [*puzzle[0][:3],*puzzle[1][:3],*puzzle[2][:3]]
sq2 = [*puzzle[0][3:6],*puzzle[1][3:6],*puzzle[2][3:6]]
sq3 = [*puzzle[0][6:9],*puzzle[1][6:9],*puzzle[2][6:9]]
    
sq4 = [*puzzle[3][:3],*puzzle[4][:3],*puzzle[5][:3]]
sq5 = [*puzzle[3][3:6],*puzzle[4][3:6],*puzzle[5][3:6]]
sq6 = [*puzzle[3][6:9],*puzzle[4][6:9],*puzzle[5][6:9]]
    
sq7 = [*puzzle[6][:3],*puzzle[7][:3],*puzzle[8][:3]]
sq8 = [*puzzle[6][3:6],*puzzle[7][3:6],*puzzle[8][3:6]]
sq9 = [*puzzle[6][6:9],*puzzle[7][6:9],*puzzle[8][6:9]]
Just find out which square it's in, and problem solved!
Reply


Messages In This Thread
Trouble with Sudoku Solver - by Techmokid - Apr-08-2020, 05:59 AM
RE: Trouble with Sudoku Solver - by Mateusz - Apr-08-2020, 06:56 AM
RE: Trouble with Sudoku Solver - by Techmokid - Apr-08-2020, 07:55 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Sudoku Solver in Python - Can someone explain this code ? qwemx 6 2,152 Jun-27-2022, 12:46 PM
Last Post: deanhystad
  Sudoku Solver, please help to solve a problem. AdithyaR 5 2,138 Oct-28-2021, 03:15 PM
Last Post: deanhystad
  building a sudoku solver usercat123 7 2,778 Oct-01-2021, 08:57 PM
Last Post: deanhystad
  unable to use result of solver in another function ross1993hall 0 1,421 Aug-10-2020, 10:29 AM
Last Post: ross1993hall
  Help with sudoku Mondata 4 2,229 Apr-13-2020, 12:35 AM
Last Post: deanhystad
  editing lists / sudoku solver monagro 5 4,072 May-29-2018, 02:16 PM
Last Post: monagro
  Word Search Solver PythonLamer 4 5,207 Oct-12-2017, 06:13 PM
Last Post: nilamo
  Need help designing a multi-threaded solver 4Dummies 8 6,095 Jun-18-2017, 08:39 PM
Last Post: 4Dummies

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020