Discussion about math, puzzles, games and fun. Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °
| |
|
|
You are not logged in. #26 2011-10-01 20:47:42
Re: Another programming problem!!!Hi; In mathematics, you don't understand things. You just get used to them. Probability is the most important concept in modern science, especially as nobody has the slightest notion what it means. 90% of mathematicians do not understand 90% of currently published mathematics. #27 2011-10-01 20:49:31
Re: Another programming problem!!!yes,but it takes so long! The limit operator is just an excuse for doing something you know you can't. “It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman “A secret's worth depends on the people from whom it must be kept.” ― Carlos Ruiz Zafón #28 2011-10-01 20:54:42
Re: Another programming problem!!!Hi anonimnystefy; In mathematics, you don't understand things. You just get used to them. Probability is the most important concept in modern science, especially as nobody has the slightest notion what it means. 90% of mathematicians do not understand 90% of currently published mathematics. #29 2011-10-01 21:24:47
Re: Another programming problem!!!but,do you know why the program won't go to the next line? The limit operator is just an excuse for doing something you know you can't. “It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman “A secret's worth depends on the people from whom it must be kept.” ― Carlos Ruiz Zafón #30 2011-10-01 21:29:48
Re: Another programming problem!!!Hi; In mathematics, you don't understand things. You just get used to them. Probability is the most important concept in modern science, especially as nobody has the slightest notion what it means. 90% of mathematicians do not understand 90% of currently published mathematics. #31 2011-10-01 21:35:57
Re: Another programming problem!!!checked the loops,seem okay. The limit operator is just an excuse for doing something you know you can't. “It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman “A secret's worth depends on the people from whom it must be kept.” ― Carlos Ruiz Zafón #32 2011-10-01 21:40:58
Re: Another programming problem!!!Just a term. A recursive program is one that calls itself. You must make sure you have a base case so that the recursion stops, else it will exhaust all your memory, crash or go on forever. In mathematics, you don't understand things. You just get used to them. Probability is the most important concept in modern science, especially as nobody has the slightest notion what it means. 90% of mathematicians do not understand 90% of currently published mathematics. #33 2011-10-01 21:48:08
Re: Another programming problem!!!well do you think it is correct? The limit operator is just an excuse for doing something you know you can't. “It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman “A secret's worth depends on the people from whom it must be kept.” ― Carlos Ruiz Zafón #34 2011-10-01 21:54:32
Re: Another programming problem!!!There is definitely an error somewhere. But you will not make much progress just by looking at it. That can help clean up syntax errors but the compiler usually spots them. In mathematics, you don't understand things. You just get used to them. Probability is the most important concept in modern science, especially as nobody has the slightest notion what it means. 90% of mathematicians do not understand 90% of currently published mathematics. #35 2011-10-01 21:56:57
Re: Another programming problem!!!input routine? The limit operator is just an excuse for doing something you know you can't. “It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman “A secret's worth depends on the people from whom it must be kept.” ― Carlos Ruiz Zafón #36 2011-10-01 21:59:02
Re: Another programming problem!!!Yes, the one that accepts your sudoku problem. In mathematics, you don't understand things. You just get used to them. Probability is the most important concept in modern science, especially as nobody has the slightest notion what it means. 90% of mathematicians do not understand 90% of currently published mathematics. #37 2011-10-01 22:01:36
Re: Another programming problem!!!it looks good. The limit operator is just an excuse for doing something you know you can't. “It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman “A secret's worth depends on the people from whom it must be kept.” ― Carlos Ruiz Zafón #38 2011-10-01 22:03:20
Re: Another programming problem!!!Not good enough! Put a print or display statement at the end of it to make sure it has the correct structure. In mathematics, you don't understand things. You just get used to them. Probability is the most important concept in modern science, especially as nobody has the slightest notion what it means. 90% of mathematicians do not understand 90% of currently published mathematics. #39 2011-10-01 22:21:46
Re: Another programming problem!!!did it.it loaded. The limit operator is just an excuse for doing something you know you can't. “It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman “A secret's worth depends on the people from whom it must be kept.” ― Carlos Ruiz Zafón #40 2011-10-01 22:24:45
Re: Another programming problem!!!Which variables represent your row and columns? In mathematics, you don't understand things. You just get used to them. Probability is the most important concept in modern science, especially as nobody has the slightest notion what it means. 90% of mathematicians do not understand 90% of currently published mathematics. #41 2011-10-01 22:26:22
Re: Another programming problem!!!i use a two-dimensional array for the values and variables i and j to run through them. The limit operator is just an excuse for doing something you know you can't. “It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman “A secret's worth depends on the people from whom it must be kept.” ― Carlos Ruiz Zafón #42 2011-10-01 22:28:18
Re: Another programming problem!!!Are i and j cycling through 1 and 9? Put a display statement inside those loops and then run a test sudoku. In mathematics, you don't understand things. You just get used to them. Probability is the most important concept in modern science, especially as nobody has the slightest notion what it means. 90% of mathematicians do not understand 90% of currently published mathematics. #43 2011-10-01 22:39:03
Re: Another programming problem!!!i inputted a sudoku and it looks like it is calculating because i cannot type anything and nothing happens when i press enter,but could it mean anything else? The limit operator is just an excuse for doing something you know you can't. “It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman “A secret's worth depends on the people from whom it must be kept.” ― Carlos Ruiz Zafón #44 2011-10-01 22:40:15
Re: Another programming problem!!!Did you put output statements to see what i and j are doing? In mathematics, you don't understand things. You just get used to them. Probability is the most important concept in modern science, especially as nobody has the slightest notion what it means. 90% of mathematicians do not understand 90% of currently published mathematics. #45 2011-10-01 22:41:59
Re: Another programming problem!!!oh that's what you meant! The limit operator is just an excuse for doing something you know you can't. “It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman “A secret's worth depends on the people from whom it must be kept.” ― Carlos Ruiz Zafón #46 2011-10-01 22:43:01
Re: Another programming problem!!!Yes, or open up the debugger and see what is happening there. In mathematics, you don't understand things. You just get used to them. Probability is the most important concept in modern science, especially as nobody has the slightest notion what it means. 90% of mathematicians do not understand 90% of currently published mathematics. #47 2011-10-06 05:19:42
Re: Another programming problem!!!help me! The limit operator is just an excuse for doing something you know you can't. “It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman “A secret's worth depends on the people from whom it must be kept.” ― Carlos Ruiz Zafón #48 2011-10-06 06:13:15
Re: Another programming problem!!!Hi anonimnystefy; In mathematics, you don't understand things. You just get used to them. Probability is the most important concept in modern science, especially as nobody has the slightest notion what it means. 90% of mathematicians do not understand 90% of currently published mathematics. #49 2011-10-06 06:28:49
Re: Another programming problem!!!well it's still the same problem but this time thanks to my friend i found an infinite lup in one of the procedures.it's named 'kolona': Code:program Sudoku_solver;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Classes
{ you can add units after this };
{$IFDEF WINDOWS}{$R Sudoku.rc}{$ENDIF}
const
max=9;
type
niz=array[1..max] of integer;
matrica=array[1..max] of niz;
var
a:matrica;
i,j,k:integer;
ok:boolean;
function red(a:matrica;i1,j1:integer):boolean;
var
j:integer;
b:boolean;
begin
b:=true;
j:=0;
while (j<=max) and (b=true) do
begin
j:=j+1;
if j<>j1 then
if a[i1][j]=a[i1][j1] then
b:=false;
end;
red:=b;
end;
function vrsta(a:matrica;i1,j1:integer):boolean;
var
i:integer;
b:boolean;
begin
b:=true;
i:=0;
while(i<=max) and(b=true) do
begin
i:=i+1;
if i<>i1 then
if a[i][j1]=a[i1][j1] then
b:=false;
end;
vrsta:=b;
end;
function kvadrat(a:matrica;i1,j1:integer):boolean;
var
i,j,k,l:integer;
b:boolean;
begin
b:=true;
case i1 of
1,2,3: begin
k:=0;
i:=3
end;
4,5,6: begin
k:=3;
i:=6;
end;
7,8,9: begin
k:=6;
i:=9;
end;
end;
case j1 of
1,2,3: begin
l:=0;
j:=3
end;
4,5,6: begin
l:=3;
j:=6;
end;
7,8,9: begin
l:=6;
j:=9;
end;
end;
while (k<=i) do
begin
k:=k+1;
while (l<=j) do
begin
l:=l+1;
if (k<>i1) and (l<>j1) then
if a[k][l]=a[i1][j1] then
b:=false;
end;
end;
kvadrat:=b;
end;
function poz(a:matrica;i,j:integer):boolean;
begin
poz:=red(a,i,j) and vrsta(a,i,j) and kvadrat(a,i,j);
end;
procedure sudoku(var a:matrica;n,i1,j1:integer;var ok:boolean);
var
i,j,k:integer;
b:boolean;
begin
i:=i1;
j:=j1;
a[i][j]:=n;
ok:=false;
if poz(a,i,j) then
begin
ok:=true;
i:=0;
j:=0;
b:=true;
while (b=true) and (i<=max) do
begin
i:=i+1;
while (b=true) and (j<=max) do
begin
j:=j+1;
writeln(i);
writeln(j);
if a[i][j]=0 then
b:=false;
end;
end;
if b=false then
begin
k:=0;
ok:=false;
while (k<=9) and not ok do
begin
k:=k+1;
sudoku(a,k,i,j,ok);
end;
end;
end;
end;
begin
writeln('Enter Sudoku: ');
for i:=1 to 9 do
begin
for j:=1 to 9 do
read(a[i][j]);
readln;
end;
for i:=1 to 9 do
begin
for j:=1 to 9 do
write(a[i][j],' ');
writeln;
end;
k:=0;
ok:=false;
while (k<=9) and not ok do
begin
k:=k+1;
sudoku(a,k,1,1,ok);
end;
if ok then
begin
writeln('Resenje je: ');
for i:=1 to 9 do
begin
for j:=1 to 9 do
write(a[i][j],' ');
writeln;
end;
end
else writeln('Sudoku cannot be solved!!!');
readln;
end.The limit operator is just an excuse for doing something you know you can't. “It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman “A secret's worth depends on the people from whom it must be kept.” ― Carlos Ruiz Zafón #50 2011-10-06 06:30:44
Re: Another programming problem!!!Hi; In mathematics, you don't understand things. You just get used to them. Probability is the most important concept in modern science, especially as nobody has the slightest notion what it means. 90% of mathematicians do not understand 90% of currently published mathematics. |