Math Is Fun Forum

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

You are not logged in.

#76 2011-10-07 01:47:17

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Another programming problem!!!

No, I meant for the purpose of checking what each box is supposed to hold.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#77 2011-10-07 01:54:46

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,049

Re: Another programming problem!!!

i think i don't understand what you mean...actually i know i don't understand what you mean.


“Here lies the reader who will never open this book. He is forever dead.
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

#78 2011-10-07 01:56:43

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Another programming problem!!!

How can you check what is supposed to be in the answer if you do not know what the answer is?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#79 2011-10-07 01:59:47

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,049

Re: Another programming problem!!!

i do have the final answer.i got the example from a Sudoku book.it has solutions in the back.


“Here lies the reader who will never open this book. He is forever dead.
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

#80 2011-10-07 02:01:19

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Another programming problem!!!

Oh, okay.

Which is the first box that has a wrong number in it?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#81 2011-10-07 02:02:38

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,049

Re: Another programming problem!!!

the third one.


“Here lies the reader who will never open this book. He is forever dead.
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

#82 2011-10-07 02:03:56

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Another programming problem!!!

That is row 1, column 3?

If so run the program to where that number is computed. There you will find the logic error.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#83 2011-10-07 02:08:05

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,049

Re: Another programming problem!!!

well,i don't know if i will get to it very fast.when it finds a number that can be in a box it moves the next empty box,and tries values for it,and again and again until it all fills up or it finds a box that no number can go into.in the second case it goes to the square it filled up before the one where 'no number can stand' and it tries the next possible value.


“Here lies the reader who will never open this book. He is forever dead.
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

#84 2011-10-07 02:10:11

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Another programming problem!!!

Put a stop command or a break command  or a pause command at the end of the routine that calculates the boxes. Then it pause after every box is calculated. Either you must do it manually by inserting the appropriate command or use your debugger.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#85 2011-10-07 02:11:53

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,049

Re: Another programming problem!!!

how do you mean calculate.it is a brute-force algorithm,nothing is calculated.


“Here lies the reader who will never open this book. He is forever dead.
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

#86 2011-10-07 02:14:23

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Another programming problem!!!

No, no, no, each box is calculated. It does not matter how. Brute force is a method calculation. Find the routine that fills the boxes with numbers. Insert at its end whatever command pauses and allows you to examine the contents of the variable at that point. This is how it is done.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#87 2012-03-19 14:01:38

Joseluis
Guest

Re: Another programming problem!!!

I wrote my own version of an Excel Soduko eatinrr and solver a while back, but I didn't have a good way to generate them until now.  Here's the concept in the alogarithm that you can program yourself.Assuming a 3 3 grid1) Put any random set of numbers in the center box obviously, one each of the digits 1-92) Fill in the box above and below the center box with any random number of choice that doesn't break the Soduko rule.3) Keep track of all of the options for each cell and give priority to assigning that random number to the CELL THAT HAS THE LEAST OPTIONS AVAILABLE TO IT.  In other words .Each cell has 9 optional digits that the cell can contain.  As you enter a value in a cell, the cells in the same box, row and column no longer have that digit as an option.  Take that option away from all other cells in the box, row and column.  They now only have 8 possible entries.  As you continue with this process, you will see that some cells may have five options left while other cells have only 3 options.  Provide a random number (that is within the available options for that cell) to the cells with less options first.4) Providing a random number in the top box and then the bottom box and then repeating seems to keep the random generation working smoothly.5) Once all cells are completed in the center column of boxes, move to either the left or right and complete all cells in column of boxes.6) To complete the cells in the left or right columns, simply apply one random number (again, within the remaining possible values) for each cell.  Give priority to cells that have the least number of options.  Try scanning the whole column of boxes and looking for cells with only one option left.  Be sure to do those first.7) Complete the last column of boxes and assign values to the cells in the same way.WORKS EVERY TIME IF YOU APPLY THE LOGIC

Board footer

Powered by FluxBB