954,549 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

sudoku

can some one help me i need the sudoku game in java programing code

jimmy bones
Newbie Poster
9 posts since Jan 2008
Reputation Points: 10
Solved Threads: 0
 

This is a forum in which you can get help for writing your own code, not a service that provides code to you.

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 

"""This is a forum in which you can get help for writing your own code, not a service that provides code to you.""""

yup she's right.... narue can i ask where can i found a community that can help me... what community will accept all legal and illegal software making>>>???
tnx

jimmy try to learn first....

technogeek_42
Posting Whiz in Training
256 posts since Dec 2007
Reputation Points: -10
Solved Threads: 3
 

I don't know of any. The communities that support illegal software are typically full of script kiddies who aren't capable of or interested in writing something new, and communities that have qualified members typically find illegal software offensive. You're basically asking for two mutually exclusive features.

p.s. For anyone else interested in answering this question, naming a community and/or linking to it would likely be in violation of Daniweb's policies.

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 

Of course some communities may not officially allow illegal stuff but have admins who are either too ignorant or too lazy to police their sites properly.

If I knew of such communities I'd however not mention them...

jwenting
duckman
Team Colleague
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
 

i am very new to c language.could you plz tell me how i proceed initially to make the soduko game..

rafikul
Newbie Poster
3 posts since Jan 2008
Reputation Points: 10
Solved Threads: 1
 

Do you know about classes and objects yet?

Phaelax
Practically a Posting Shark
858 posts since Mar 2004
Reputation Points: 92
Solved Threads: 51
 

Seeing as the kid is talking about C, why should it know about classes and objects?
It doesn't seem interested in learning to program itself anyway, only in tricking people into giving it a complete solution it can turn in as the solution to its homework assignment so it doesn't get a failing grade.

jwenting
duckman
Team Colleague
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
 

here is a sample code in C++ soduko

#include <iostream.h>
void main()
{
	int k[9][9],K[9][9];
	int i,j,i1,j1,i2,j2;
	int error,temp;
	int count=0;

	for(i=0;i<9;i++)
	for(j=0;j<9;j++)
		K[i][j]=0;

	for(i=0;i<9;i++)
	for(j=0;j<9;j++)
	{
		cin>>K[i][j];
		k[i][j]=K[i][j];
	}
	cout<<"O.K.? (Enter 0 if OK, 1 to update): ";
	cin>>error;
	if(error==0)
		goto matrixvalidation;

matrixupdation:
	while(1)
	{
		cout<<"Enter Row, Col, Revised number:(0 to exit) ";
		cin>>i;
		if(i==0)break;
		cin>>j>>temp;
		if(i>0&&j>0&&temp>=0&&i<10&&j<10&&temp<10)
		{
			K[i-1][j-1]=temp;
			k[i-1][j-1]=temp;
		}
		else
			cout<<"Enter row/column 1 to 9 & number 0 to 9 only.
";
	}

matrixvalidation:
	cout<<"
Input matrix:
";
	for(i=0;i<9;i++)
	{
		for(j=0;j<9;j++)
			cout<<k[i][j]<<" ";
		cout<<"
";
	}

	for(i=0;i<9;i++)
	for(j=0;j<9;j++)
		if(k[i][j]<0||k[i][j]>9)
		{
			cout<<"
"<<i+1<<" "<<j+1<<" "<<k[i][j];
			cout<<"
Input matrix error.";
			cout<<"
Numbers should be 1 to 9 only.

";
			goto matrixupdation;
		}

	for(i=0;i<9;i++)
	for(j=0;j<9;j++)
	{
		if(k[i][j]==0)continue;
		error=0;
		for(i1=0;i1<9;i1++)
			if(i!=i1&&k[i][j]==k[i1][j])
			{
				error=1;
				i2=i1;
				j2=j;
			}
		for(j1=0;j1<9;j1++)
			if(j!=j1&&k[i][j]==k[i][j1])
			{
				error=1;
				i2=i;
				j2=j1;
			}
		for(i1=0;i1<9;i1++)
		for(j1=0;j1<9;j1++)
			if((i!=i1||j!=j1)&&i/3==i1/3&&j/3==j1/3&&k[i][j]==k[i1][j1])
			{
				error=1;
				i2=i1;
				j2=j1;
			}
		if(error)
		{
			cout<<"
"<<i+1<<" "<<j+1<<" "<<k[i][j];
			cout<<"
"<<i2+1<<" "<<j2+1<<" "<<k[i2][j2];
			cout<<"
Input matrix error.";
			cout<<"
A number has been repeated in the same row, col or
block.

";
			goto matrixupdation;
		}
	}

/* Logic starts: */
	for(i=0;i<9;i++)
	for(j=0;j<9;j++)
	{
		if(K[i][j]>0) goto chksol;
		for(k[i][j]++;k[i][j]<=9;k[i][j]++)
		{
			error=0;
			for(i1=0;i1<9;i1++)
				if(i!=i1&&k[i][j]==k[i1][j])error=1;
			for(j1=0;j1<9;j1++)
				if(j!=j1&&k[i][j]==k[i][j1])error=1;
			for(i1=0;i1<9;i1++)
			for(j1=0;j1<9;j1++)
				if((i!=i1||j!=j1)&&i/3==i1/3&&j/3==j1/3&&k[i][j]==k[i1][j1])
					error=1;
			if(error==0)break;
		}
		if(k[i][j]>9)
		{
			k[i][j]=0;
			do
			{
				if(i==0&&j==0)goto nomoresol;
				if(j>0)j--;else{j=8;i--;}
			}while(K[i][j]>0);
			j--;
		}
chksol:	if(i==8&&j==8)
		{
			cout<<"
Solution: "<<++count<<"
";
			for(i1=0;i1<9;i1++)
			{
				for(j1=0;j1<9;j1++)
					cout<<k[i1][j1]<<" ";
				cout<<"
";
			}
			if(count==50)
			{
				cout<<"
Too many solutions.
Not checking for more 
solutions.

";
				return;
			}

			while(K[i][j]>0)
			{
				if(i==0&&j==0)goto nomoresol;
				if(j>0)j--;else{j=8;i--;}
			}
			k[i][j]=0;
			do
			{
				if(i==0&&j==0)goto nomoresol;
				if(j>0)j--;else{j=8;i--;}
			}while(K[i][j]>0);
			j--;
		}
	}
nomoresol:
	if(count>0)
		cout<<"
No more solutions.

";
	else
		cout<<"No solution.

";
}
technogeek_42
Posting Whiz in Training
256 posts since Dec 2007
Reputation Points: -10
Solved Threads: 3
 

the code shows its worth in the 2nd line...

jwenting
duckman
Team Colleague
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
 
the code shows its worth in the 2nd line...


what's the problem on the second line???

technogeek_42
Posting Whiz in Training
256 posts since Dec 2007
Reputation Points: -10
Solved Threads: 3
 

>what's the problem on the second line???
There are two problems:

1) Technical
The C++ standard specifies that the main function must return an integer. It has never returned void, as C++ is based on C, and C has never returned void from main. The void main issue was born of C dialects before it was standardized, and by that time too many people already had the habit of using void main. Thus, some compilers decided to support this style for convenience, which set a backward compatibility problem where void main will never go away.

By using void main, your code is not portable beyond the compiler you wrote it with. That's the real problem, but if you had no intention of portability, the only problem is personal (see below).

2) Personal
The problem on the second line (in that it shows the worth of the entire program) displays an elitist view of programming and a general disdain for anyone who doesn't hold language standards as the word of God. Using the problem on the second line to avoid reading the rest of the code is occasionally used as an excuse to avoid facing one's lack of understanding of other people's code. However, it's more often used as a weapon by language snobs to dismiss the efforts of beginners or anyone with whom the snob has a difference of opinion.

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 
Seeing as the kid is talking about C


I was referring to the first post where he specifically asked for Java code, not the guy who attempted to hijack the thread.

Phaelax
Practically a Posting Shark
858 posts since Mar 2004
Reputation Points: 92
Solved Threads: 51
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You