POV-Ray : Newsgroups : povray.binaries.images : Sudoku : Sudoku Server Time
14 Jan 2025 19:15:47 EST (-0500)
  Sudoku  
From: kurtz le pirate
Date: 10 Jan 2025 12:54:59
Message: <67815ef3@news.povray.org>
Good evening everyone


The attached image is a Sudoku grid.

It's not just numbers and lines, it's solving a Sudoku grid.

The starting grid is defined as follows in the code :

#declare board = array[SIZE][SIZE] {
   {0,8,0,3,0,0,7,0,6},
   {6,0,3,2,0,8,4,0,0},
   {2,0,0,4,9,6,3,1,0},
   {8,0,0,0,6,4,0,0,0},
   {7,0,0,1,0,0,0,0,0},
   {0,9,6,0,0,7,0,4,2},
   {3,0,8,0,2,0,1,5,4},
   {4,0,9,8,0,1,6,0,0},
   {5,6,0,7,4,3,2,0,9}
   }


The starting digits in yellow, solution digits in blue.

Everything runs smoothly and quickly.
For this grid, the times are :
  - Parse Time : 0.124 sec
  - Render Time : 1.070 sec
  on an old Intel Core i5, 6 cores.


All seemed well, but, but... the greater the difficulty (fewer and fewer 
starting digits), the greater the level of recursivity of the main 
function and the POV hang with the tragic message "Too many nested 
conditionals or macros." :(

The same code in C works without a hitch whatever the level of difficulty



It's true that POV isn't really designed for big calculations.
I'm well aware that I'm overstepping my boundaries.

By the way, just to understand, what limits the level of nested calls?
Memory? (It's true that in 1986, machines didn't have much memory.)




So I need to find another method without recursive calls. The little 
information I've found on the web suggests replacing recursive calls 
with a loop... hum... hum...
I think I'm going to have a big headache this weekend!




If anyone's interested, I've also attached the text file containing the 
debug stream redirection.



-- 
kurtz le pirate
compagnie de la banquise


Post a reply to this message


Attachments:
Download 'sudoku_solver.txt' (2 KB) Download 'sudoku_solver_display.png' (159 KB)

Preview of image 'sudoku_solver_display.png'
sudoku_solver_display.png


 

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.