• Post Reply Bookmark Topic Watch Topic
  • New Topic

sudoku  RSS feed

 
christian fabiano
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am new to java so "forgive" my level of understanding. i need help in writing a program to read a sudoku puzzle from a file.the file should contain 9 lines of text, each line being nine characters long. the digits 1 to 9 will be in their correct positions and unknown positions/cells will be represented by the digit 0. once loaded the program should display the grid followed by a blank line.
I would greatly appreciate a prompt response as i nedd asap.
thx
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A good place to start would be a tutorial on I/O: http://java.sun.com/docs/books/tutorial/essential/io/index.html
 
Matt Gatten
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're looking to just display it and check the results then you could create a list of arrays which are 9 'ints' long or better yet, an array of arrays so you could refer to each input with a getBlock[x][y] method. Treat each one like a coordinate on a map. Then you could create several loops to determine the validity of the numbers. I've been thinking about taking a stab at a sudoku solver using this technique.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!