Welcome to MSDN Blogs Sign in | Join | Help

Computer Science Teacher - Thoughts and Information from Alfred Thompson

Alfred Thompson's blog about teaching computer science at the K-12 level. Alfred was a high school computer science teacher for 8 years. He has also taught grades K-8 as a computer specialist. He has written several textbooks and project books for teaching Visual Basic in high school and middle school. Alfred is the K-12 Computer Science Academic Relations Manager for Microsoft and is trying to be the Microsoft Education Blogger.

Syndication

News


Featured in Education.AllTop.com



TwitterCounter for @alfredtwo




Sudoku in Visual Basic .NET

I found an interesting little program that creates Sudoku puzzles in Visual Basic .NET. I have to say that I really love it. But not for the reasons one might expect. I don't love it for the amount of cool features it has. Frankly it doesn't have all the bells and whistles that a lot of Sudoku programs I have seen do have. That is, paradoxically, why I love it. If you are looking for something fun to play with, uh, I mean work with and learn from, over the holiday break this may be just the thing.

Let me explain. One of the great learning experiences one can have is taking an existing and functional program and adding features to it. Now while I agree with my college professor who told me over 30 years ago that no program is ever really finished it's nice to have some low hanging fruit. This program has room for all sorts of additional features. What sort of features?

  • Adding color coding of rows, columns or subgrids that are completed.
  • Additional error checking
  • A timer - how long does it take you to finish?
  • Top times recording - ideally at each level
  • Replace the command buttons with textboxes for easier input
  • Tablet PC input with ink!
  • Make a Pocket PC version. IF you do that let me know so I can get a copy from you.
  • Probably a lot more that I haven't even had time to think about.

You will be able to work on this program using Visual Basic .NET Express. It was written for Visual Basic 2003 but Express upgraded it nicely for me without any errors. A couple of warnings that we easily fixed because I hate warnings.

Send your students after this one. Try it out yourself. Is it the greatest implementation of Sudoku ever? No it's not. But what it is is an easy to understand, very manageable piece of code that lends itself to extension, expansion, improvement, experimentation and just plain fun. And are those all really good things for over the holidays?

Speaking of holidays - I'm taking next week off. It's time to spend Christmas with my family. Will I be blogging? Probably not very much if at all. I hope you are all getting some time off for the end of the year and enjoy what ever holiday you celebrate.

 


Published Wednesday, December 20, 2006 2:14 AM by Alfred Thompson

Comments

# Alfred Thompson's blog entry on Sudoku @ Wednesday, December 20, 2006 3:33 AM

Alfred Thompson has a very good entry on Sudoku and Visual Basic .NET Express in education . Send your

Walter Stiers - Academic Program Manager

# Sudoku in Visual Basic .NET @ Wednesday, December 20, 2006 3:52 AM

I found an interesting little program that creates Sudoku puzzles in Visual Basic .NET. I have to say...

AlfredTwo

# re: Sudoku in Visual Basic .NET @ Wednesday, December 20, 2006 8:55 AM

Sorry but the example "Sudoku and Visual Basic .NET Express" version does not produce Sudoku puzzles, as they have more than one result. The first puzzle i tested against had 127 different end results. Sudoku has only one end. The code needs a little bit more work until it does what it says on the box.

For an app that offers 35600 Sudoku 17 clue puzzles with solver and proof function go to http://www.onedollarsudoku.com and spend $1 US.

OneDollarSudoku

# re: Sudoku in Visual Basic .NET @ Wednesday, December 20, 2006 9:53 AM

You may be right. But I think the fact that there is VB source code that allows for a lot of room to try things and modify the program makes it useful for learning. The point is not really to solve the puzzle but to learn from the program.

Alfred Thompson

# re: Sudoku in Visual Basic .NET @ Thursday, December 21, 2006 2:29 PM

I have to agree with OneDollarSudoku: the definition of a "true" Sudoku puzzle is one where there is a single solution that can be solved without guessing. (THIS is what makes puzzle generators notoriously hard to write!) But, as you say, it is useful as a teaching tool.

Tom Indelicato

# re: Sudoku in Visual Basic .NET @ Thursday, December 21, 2006 2:56 PM

Well then we have another teachable moment here. The nice thing is that someone can write a better puzzle generating routine and throw it in to an existing structure for testing purposes. Weren't you working on something along those lines Tom? :-)

Alfred Thompson

# re: Sudoku in Visual Basic .NET @ Saturday, December 30, 2006 8:47 AM

That's not the best Sudoku Example you could choose. The code is pretty clumsy, with no distinction between the Sudoku Generation Code and the UI code. And it uses something which looks like Control Arrays of VB6... And, this is coming from a self-taught high school student who loves your blog:D

Yuvi

# re: Sudoku in Visual Basic .NET @ Saturday, December 30, 2006 10:17 AM

I can't disagree with you Yuvi. I would love to see someone clean that one up so I could use that as an "after" example in a before and after sample. Want to give it a try?

Alfred Thompson

New Comments to this post are disabled
Page view tracker