• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

How to print a 9x9 array?

 
Ranch Hand
Posts: 574
VI Editor Chrome Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's a Sudoku puzzle, I can display it fine, but how do I send it to the printer? Doing a screen cap doesn't count. Needs to have lines showing a 9x9 array, bonus if the starting numbers are bolded or somesuch.

To be honest a local paper has a contest where if you finish their puzzle in 4 days you can win a t-shirt. I spent 2 days writing a java Sudoku solver, now I don't care about the t-shirt I just want my name to show up where nobody of any importance can see it.

If you want the code let me know, I'll email it to you. It's really fun as every time I enter the solve routine I print out the depth, then use gnuplot to graph the results. Takes 2-3 seconds to solve the puzzle, I'm guessing 90% of that is printing the depth, but graphing the result is strangely hypnotic.
 
Marshal
Posts: 76406
364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What algorithm do you use to solve the puzzle? I used the naïve technique of subtracting from sets of available numbers so I can see backtracking. I had one puzzle (there is a chap at Coventry who has a database of 22000 puzzles) which took over 5× as long for the computer to solve as it took me with a pencil.
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:What algorithm do you use to solve the puzzle?


Forget solving it. I'd like to know how to create a Sudoku puzzle, 'cause I bet once you've got that, the solution's easy.

Winston
 
Jim Venolia
Ranch Hand
Posts: 574
VI Editor Chrome Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The algorithm is nothing but brute force recursion. I wrote it as I wanted to refresh my recursion skills.
 
You got style baby! More than this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic