A1VBCode Forums

HELP NEEDED IN SUDOKU !!! in C #


http://www.a1vbcode.com/vbforums/Topic25873.aspx

By juve10 - 10/4/2008

I'm stucked

this is what I've done until now...

can anyone help

using System;public class Sud {   public static void Main() 
{      int[,] sudoku = new int[9,9];            Console.WriteLine("Enter the 9x9 Sudoku solution: ");
      string line;      char[] delims = {' '};      for (int i = 0; i < 9; i++) {         line = Console.ReadLine();         string[] tokens = line.Split(delims);         for (int j = 0; j < 9; j++) {            if (tokens[j] == "_") {               sudoku[i,j] = 0;            }            else {               sudoku[i,j] = Convert.ToInt32(tokens[j]);            }         }      }      Console.WriteLine();            
Guys,
 
the sudoku array holds the beginning puzzle      an entry is 0 if it is blank, otherwise it has a 1-9 value             Now, I want to print the available "moves" for each blank spot      
 
By juve10 - 10/4/2008

this looks nicer
using System;
 
public class sud 
public static void Main(){
 
 int[,] sudoku = new int[9,9];
 
Console.WriteLine("give the 9x9 solution: ");
 
string line;
 
char[] delims = {' '};for (int i = 0; i < 9; i++) {line = Console.ReadLine();string[] tokens = line.Split(delims);
 
for (int j = 0; j < 9; j++) {if (tokens[j] == "_") {sudoku[i,j] = 0;}
 
else {sudoku[i,j] = Convert.ToInt32(tokens[j]);
}}}Console.WriteLine();