Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

## #26 2011-10-01 20:47:42

bobbym

Offline

### Re: Another programming problem!!!

Hi;

Do you know how to use them?

In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

## #27 2011-10-01 20:49:31

anonimnystefy
Real Member

Offline

### Re: Another programming problem!!!

yes,but it takes so long!

anyway i noticed that the program acts weirdly around ones.

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
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

## #28 2011-10-01 20:54:42

bobbym

Offline

### Re: Another programming problem!!!

Hi anonimnystefy;

I know it takes a long time. Debugging a program is a very personal thing. You have to single step through the program checking the variables after each step. Or go through your code by hand writing down what each line does. Seeing whether or not it actually does what you think it should. Then you will find the offending line. There is no other way.

In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

## #29 2011-10-01 21:24:47

anonimnystefy
Real Member

Offline

### 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
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

## #30 2011-10-01 21:29:48

bobbym

Offline

### Re: Another programming problem!!!

Hi;

Probably because your looping structure is not going throw every row like it is supposed to. Check your loops or your recursive subroutine.

In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

## #31 2011-10-01 21:35:57

anonimnystefy
Real Member

Offline

### Re: Another programming problem!!!

checked the loops,seem okay.

what's recursive subroutine?

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
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

## #32 2011-10-01 21:40:58

bobbym

Offline

### 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.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

## #33 2011-10-01 21:48:08

anonimnystefy
Real Member

Offline

### Re: Another programming problem!!!

well do you think it is correct?

i was just confused by the subroutine part.

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
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

## #34 2011-10-01 21:54:32

bobbym

Offline

### 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.

Perhaps your while loops are terminating prematurely. Is your input routine working? Have you checked?

In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

## #35 2011-10-01 21:56:57

anonimnystefy
Real Member

Offline

### 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
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

## #36 2011-10-01 21:59:02

bobbym

Offline

### 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.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

## #37 2011-10-01 22:01:36

anonimnystefy
Real Member

Offline

### 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
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

## #38 2011-10-01 22:03:20

bobbym

Offline

### 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.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

## #39 2011-10-01 22:21:46

anonimnystefy
Real Member

Offline

### Re: Another programming problem!!!

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
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

## #40 2011-10-01 22:24:45

bobbym

Offline

### Re: Another programming problem!!!

Which variables represent your row and columns?

In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

## #41 2011-10-01 22:26:22

anonimnystefy
Real Member

Offline

### 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
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

## #42 2011-10-01 22:28:18

bobbym

Offline

### 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.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

## #43 2011-10-01 22:39:03

anonimnystefy
Real Member

Offline

### 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
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

## #44 2011-10-01 22:40:15

bobbym

Offline

### 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.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

## #45 2011-10-01 22:41:59

anonimnystefy
Real Member

Offline

### 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
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

## #46 2011-10-01 22:43:01

bobbym

Offline

### 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.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

## #47 2011-10-06 05:19:42

anonimnystefy
Real Member

Offline

### 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
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

## #48 2011-10-06 06:13:15

bobbym

Offline

### Re: Another programming problem!!!

Hi anonimnystefy;

What is wrong?

In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

## #49 2011-10-06 06:28:49

anonimnystefy
Real Member

Offline

### 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
{\$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;

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;
end;

function poz(a:matrica;i,j:integer):boolean;
begin
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
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!!!');
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
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

## #50 2011-10-06 06:30:44

bobbym

Offline

### Re: Another programming problem!!!

Hi;

Answer me honestly, did you write this code or did you use what was at the Lazarus site?

In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.