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

You are not logged in.

- Topics: Active | Unanswered

**Ricky****Moderator**- Registered: 2005-12-04
- Posts: 3,791

How about something on sudoku for the website?

I'd be willing to write up a basic introduction to group theory and how it relates to sudoku, as well as a sudoku java app game.

What do you think?

"In the real world, this would be a problem. But in mathematics, we can just define a place where this problem doesn't exist. So we'll go ahead and do that now..."

Offline

**Patrick****Real Member**- Registered: 2006-02-24
- Posts: 1,005

I'd say: Go for it.. I'm pretty sure that they're willing to host it, if it's correct

Support MathsIsFun.com by clicking on the banners.

What music do I listen to? Clicky click

Offline

**krassi_holmz****Real Member**- Registered: 2005-12-02
- Posts: 1,905

I've wrote somewhere some kinda stuff.It will be cool.

I'm curious mofe for the sudoku-graph theory than the suboku.

How will this java app solve the sudoku?

IPBLE: Increasing Performance By Lowering Expectations.

Offline

**justlookingforthemoment****Moderator**- Registered: 2005-05-26
- Posts: 2,161

Maybe something similar to this? But we could keep track of who solves each one first, and have a hall of fame...

Offline

**krassi_holmz****Real Member**- Registered: 2005-12-02
- Posts: 1,905

But there's no theory!!!

IPBLE: Increasing Performance By Lowering Expectations.

Offline

**MathsIsFun****Administrator**- Registered: 2005-01-21
- Posts: 7,651

Let me think ...

Its Mathematical ...

Its Fun ...

... YES!

"The physicists defer only to mathematicians, and the mathematicians defer only to God ..." - Leon M. Lederman

Offline

**krassi_holmz****Real Member**- Registered: 2005-12-02
- Posts: 1,905

How will you make it?

Please inform us for the progress.

IPBLE: Increasing Performance By Lowering Expectations.

Offline

**Ricky****Moderator**- Registered: 2005-12-04
- Posts: 3,791

I have spring break coming up, an entire week off from school with absolutely no plans. So I'll be working on it then.

"In the real world, this would be a problem. But in mathematics, we can just define a place where this problem doesn't exist. So we'll go ahead and do that now..."

Offline

**MathsIsFun****Administrator**- Registered: 2005-01-21
- Posts: 7,651

Excellent - if you want to, we can work on it together somehow. (Maybe krassi or others want to help, too.)

I can help by putting a "front-end" on to the game. If you can get something working in java, I could then try to "translate" it to javascript and get it working in flash (flash uses a version of javascript called actionscript). (It would help if you don't get too tricky in java!).

But these are only suggestions - it is your idea and you da boss.

(My experience on collaboration is this: each person has their own project, and people get together occassionally to define "interfaces")

"The physicists defer only to mathematicians, and the mathematicians defer only to God ..." - Leon M. Lederman

Offline

**jU****Real Member**- Registered: 2005-08-17
- Posts: 1,923

tell me when it comes cause I'll give it ago

Offline

**MathsIsFun****Administrator**- Registered: 2005-01-21
- Posts: 7,651

Oooh Oooh ... http://sudoku.sourceforge.net/

"The physicists defer only to mathematicians, and the mathematicians defer only to God ..." - Leon M. Lederman

Offline

**MathsIsFun****Administrator**- Registered: 2005-01-21
- Posts: 7,651

Ouch ... that one was hard to follow.

I was hoping to find some free source code to "kickstart" this project, and I have found a whole foum discussing the subject of programming Sudoku here: http://www.setbb.com/phpbb/viewforum.php?f=9&mforum=sudoku

And a wikpedia article of links (free source section near bottom): http://en.wikipedia.org/wiki/Talk:Sudoku/links_to_consider

And I found one in javascript here: http://sudoku.pjoneil.net/ (but the author doesn't want his source code altered)

(BTW: I have never done a Sudoku, is that strange?)

Offline

**Ricky****Moderator**- Registered: 2005-12-04
- Posts: 3,791

If you are going to rewrite it in Flash, I can just work on more of a psuedo-algorithm. I'm guessing you can do the whole interface, it's just the solving algorithm that you need help with?

I have quite a few ideas for that, so I'll be working on that as well.

Here's basically what I was thinking:

Keep an array of numbers for every block in the board, which will hold a list of possible numbers.

If the array size is 1, then put that number in the board.

Then have a checkCol, checkRow, checkArea, which all check for certain patters such as two different boxes only having a 4 and 6, thus, those are the only places 4 and 6 can go, and then eliminating them from all other places.

That will at least narrow down the possibilities, if not solve the puzzle. Then use a brute force branching algorithm to guess at every possible solution and arrive at contradictions or final solutions.

"In the real world, this would be a problem. But in mathematics, we can just define a place where this problem doesn't exist. So we'll go ahead and do that now..."

Offline

**mathsyperson****Moderator**- Registered: 2005-06-22
- Posts: 4,900

MathsIsFun wrote:

(BTW: I have never done a Sudoku, is that strange?)

If by 'strange' you mean 'rare', then probably. Pretty much everyone I know has tried/done/been addicted to sudoku. But if you mean 'odd' then not at all. You probably just have better things to do with your time.

I can do most sudokus fairly easily, but I tend not to because after a while they just get boring. I prefer the other one, that's similar but involves maths too. I can't remember what it's called.

Also, didn't Zach say that he wrote a sudoku code?

Why did the vector cross the road?

It wanted to be normal.

Offline

**ryos****Member**- Registered: 2005-08-04
- Posts: 394

I still don't know what a sudoku is.

Edit to say something valuable: Mathsy, are you talking about "magic squares"? The ones where you have to make all the rows, columns, and diagonals add up to a certain number? We did some of those in elementary school...

*Last edited by ryos (2006-03-02 07:54:21)*

El que pega primero pega dos veces.

Offline

**mathsyperson****Moderator**- Registered: 2005-06-22
- Posts: 4,900

No, not magic squares. Hang on...

After much research (well, 2 minutes on google), the puzzle that I like is 'Kakuro'. There we go.

Why did the vector cross the road?

It wanted to be normal.

Offline

**Ricky****Moderator**- Registered: 2005-12-04
- Posts: 3,791

ryos, you'll know soon enough

MathIsFun, how similar is actionscript to java script? I know basic java script and I plan on learning Flash soon (I got a book, just haven't opened it yet, that's the next step). If it's pretty much the same, I can write psuedo code that should be easy to put in java script, and thus (hopefully) easy to put in action script.

Offline

**justlookingforthemoment****Moderator**- Registered: 2005-05-26
- Posts: 2,161

Let's have a samurai sudoku. It's the same, except it looks like this:

It takes ages.

Offline

**jU****Real Member**- Registered: 2005-08-17
- Posts: 1,923

well dur

Offline

**MathsIsFun****Administrator**- Registered: 2005-01-21
- Posts: 7,651

Ricky wrote:

How similar is actionscript to java script? I know basic java script and I plan on learning Flash soon (I got a book, just haven't opened it yet, that's the next step). If it's pretty much the same, I can write psuedo code that should be easy to put in java script, and thus (hopefully) easy to put in action script.

Pretty similar. Both based on the same spec. See http://en.wikipedia.org/wiki/Actionscript and you will know more than I

I use a product called SwishMax (from SwishZone), as I find it easier to use than original Flash. I am by no means an expert on either.

Anyhoo, the good news is that I have a basic user-interface working now, and you can look at it here.

It isn't pretty, suggestions welcome!

On my side I can have these functions working:

SetNum(row, col, num); // sets the square at (row,col) to "num"

IsFixedNum(row, col); // sets the square at (row,col) to being a fixed "clue" cell

On your side something like:

CreateSudoku(...); // when the user presses a "New Game" button

CheckSudoku(...); // has the user solved it

Or something like that, we will know better as we get going!

Here is some sample code for you. This is what happens when you press the "fill badly" button:

```
on (press) {
for (row=0; row<BoardSize; row++) {
for (col=0; col<BoardSize; col++) {
obj = eval("B_"+row+"_"+col);
if (Math.random()>0.7) {
obj.SetNum(col+1,false);
obj.IsFixedNum(true);
} else {
obj.SetNum(" ",false);
obj.IsFixedNum(false);
}
}
}
}
```

That strange code "obj = eval("B_"+row+"_"+col);" is because the squares are called "B_0_0", "B_0_1" etc

And I use a random number to decide if it will be a fixed cell or not. And the number in the square is just the column number +1.

Offline

**MathsIsFun****Administrator**- Registered: 2005-01-21
- Posts: 7,651

Any comments Ricky?

Offline

**Ricky****Moderator**- Registered: 2005-12-04
- Posts: 3,791

For the explanation part would you like me to write it in hmtl or just plain text?

For the programming, I was planning on representing the board by a 2d matrix of arrays. Would that be a problem for you?

*Last edited by Ricky (2006-03-09 11:37:05)*

Offline

**MathsIsFun****Administrator**- Registered: 2005-01-21
- Posts: 7,651

Well, I would cut-and-paste it into the general site template, then re-format it as necessary to make it look the best. So you can include html if you want, but general text is fine.

Let me know ho you want your "attribution".

The array type in actionscript is A[i], but you can have arrays of arrays like A[i][j] etc.

It may be easier for me to have something like Board[row][col] (representing the numbers), and if you want to represent other properties (like cell-type) you could have another 2d array like CellType[row][col].

Alternatively you could have Board[row][col][prop] where prop is the property number (say 0=current value, 1=cell type, etc)

I could have two functions Array2Screen() and Screen2Array() to make it easy to communicate between my user interface and your engine.

Offline

**Ninja 101****Member**- Registered: 2006-02-20
- Posts: 936

i still haven't worked out how to do thon samurai sudoku puzzles.

mainly because i never try.

i look at one, shout 'gosh' then go to sleep.

*Last edited by Ninja 101 (2006-03-29 02:34:15)*

Chaos is found in greatest abundance wherever order is being saught. It always defeats order, because it is better organized.

Offline

**MathsIsFun****Administrator**- Registered: 2005-01-21
- Posts: 7,651

Ninja 101 wrote:

i look at one, shout 'gosh' then go to sleep.

LOL! That would be funny to see.

Offline