Sudoku Game

by Rob 16. May 2011 20:05

There's no shortage of Sudoku games, tutorials, and even source code, online....but I had a slow weekend and figured I'd take a stab at it.  One of these days, I'll rewrite it in F#.  Anyway - here's the core of it:

    Public Sub Solve()
        While SetObviousValues()            
        End While

        If IsSolved Then
            Print()
            Exit Sub
        End If

        Dim BestPoint As Point = GetLowestPossibleValuePoint()

        If BestPoint.X <> -1 Then
            Dim GuessVals() As Integer = GetPossibleValues(BestPoint.X, BestPoint.Y)

            If GuessVals.Count <> 0 Then
                For i As Integer = 0 To GuessVals.Count - 1                    
                    Dim newNumbers(,) As Integer = _Numbers.Clone
                    newNumbers(BestPoint.X, BestPoint.Y) = GuessVals(i)
                    Dim newGrid As New Grid(newNumbers)

                    newGrid.Solve()
                Next
            End If
        End If

    End Sub

This will find all possible solutions to a given puzzle.  Here's how'd you use it (as a console application)...

        Dim StartVal(,) As Integer = { _
                                    {0, 0, 0, 0, 0, 0, 0, 7, 6}, _
                                    {0, 0, 0, 0, 7, 8, 0, 0, 2}, _
                                    {8, 0, 0, 0, 4, 2, 3, 0, 0}, _
                                    {1, 0, 9, 0, 0, 0, 0, 0, 0}, _
                                    {0, 2, 0, 7, 8, 9, 0, 4, 0}, _
                                    {0, 0, 0, 0, 0, 0, 9, 0, 5}, _
                                    {0, 0, 2, 8, 6, 0, 0, 0, 7}, _
                                    {7, 0, 0, 2, 1, 0, 0, 0, 0}, _
                                    {4, 5, 0, 0, 0, 0, 0, 0, 0}}

        Dim myGrid As New Grid(StartVal)

        myGrid.Print()
        Console.Read()
        myGrid.Solve()

The source is available here.  

Or, you can play the online version here

Categories:

Why I Don't Like StackOverflow.com

by Rob 11. May 2011 08:12


I love the concept of StackOverflow.....a super Q&A site, moderated by the users themselves.  Everything is searchable, taggable, editable.  From time to time, I'd search a question on Google and find myself at StackOverflow.com quickly getting an answer.  What's not to love?

That is, until I started actively contributing to it.  

Let's face it, programming languages, frameworks, best practices and the like change much more slowly than it takes for someone to ask a great question about those changes.  The good questions are already asked.  So, what's left?  High school and college kids pasting homework questions into SO, lazy programmers asking a question directly rather than taking 30 seconds to search for it, lazy programmers asking for someone else to debug their code, and SO users intentionally asking questions to gain reputation.  That's about it.  

Since these questions have little value to anyone other than the person asking the question, as soon as it is answered it will sit unused and unloved down in the dirtiest corners of some database.  If you want to earn any reputation, you don't just need to answer the question, you need to answer it *now*.  And you need to cross your fingers because providing the correct answer doesn't mean you'll get anything.  You are still racing the other SO users and entirely dependent on the asker selecting your answer as correct.

What an odd situation that is!  You have groups of software developers fighting to be the first to do some CSCI 101 homework to earn reputation.  Which raises my next question:

Why Do You See The Reputation and Picture Of People Who Participate in SO? 

If you wanted to impartially determine which answer in a list of answers is the best; certainly, you'd want to EXCLUDE that information.  Let each answer be judged on it's own merit.  Isn't that supposed to be one of the defining positives of the internet?  Anecdotally, I've found that the more reputation I earn, the more likely I am to receive upvotes and the less likely my questions are to be closed.  Because, again, the majority of questions are trivial it's not uncommon for multiple people to post equivalent answers within seconds or minutes.  Who is most likely to get the upvotes/accepted answer?  Whomever has more rep and more badges.  And a picture!  Either a funny, clever or professional one seems to have the best results.  If you have 1 rep and the default autogenerated image....well, it'll be an uphill battle.

Don't get me wrong, I'm not against tracking reputation or having a profile picture.  I'm also not suggesting that the top members of SO aren't really smart, really knowledge people.  But the question of 'why' is a pretty obvious one.  The creators of StackOverflow and the sister sites (StackExchange, I think they are calling it) have really just provided a framework for Q&A (and please, don't think I'm trivializing their work...it's a GREAT Q&A Framework.  Arguably the best ever created).  The *value* of the site, the reason people go, is to get answers.  When you answer a question, you are, quite literally, unpaid tech support.  There is very little tangible benefit to you.  Some people will argue that you are *learning*.  I don't buy it.  The same time spent reading a book or following tutorials would yield far more knowledge than the same time spent answering other people's questions on SO.  So, instead, you are paid in bits.  Virtual badges of honor you can proudly display.  But is it worth it?

Maybe.  But not for me.  I'm leaving SO for the same reasons I left WoW.  I've going to chase a carrot, it's not going to be a *virtual* carrot.

Categories:

Google Voice And Sprint....No Thanks!

by Rob 5. May 2011 16:39

If you haven't already heard, Goole and Sprint have partnered up.  Now Sprint customers can seemlessly integrate Google Voice with their Sprint account.  
http://www.sprint.com/landings/googlevoice 

Best of all - it's free!  Or so they claim.

What happens to my monthly plan with Sprint?Nothing changes. You don't pay more for these new features, and you don't have to sign a new contract. Your monthly minutes, texts and calling features all stay the same

As it turns out, that is only half true.  

If you are already using Google Voice you are used to sending and receiving phone calls from the www.gmail.com website.  Previously, this was free and Sprint was not involved at all.  You were simply a Google Voice user making a Google Voice call.  But if you link your Sprint account and Google Voice account....your previously free calls now cost you money.  That's right, the same call that was free and didn't involve Sprint *at all* yesterday; will now use your Sprint minutes.  

Rob Paulson: "Yesterday, if someone called my GV number and I answered it on the computer; Sprint would not be involved at all.  It was free.  Today, I linked my Sprint # and my GV account.  If someone calls me today, dialing my Sprint #, and I answer on my computer; it will use my Sprint minutes. 

Rob Paulson: "Is that correct?"

Agent (Katherine B): "Yes, you are correct."

So you need to sacrifice the best part of Google Voice (free calls) in order to use your Sprint number.  And the only benefit you get is that you can use your Sprint phone number?  But only as long as you are a Spring customer!

If your Sprint contract expires. You will be on a month to month basis and your services will not be impacted unless you request to conclude your services with Sprint. Keep in mind, should you choose to cancel your services and want to keep your number with Google Voice. You would need to port your number to Google Voice.

Unless you plan on sticking with Sprint forever, you are either going to lose your phone number or you are going to pay $20 to port the number to Google.  In either case, why not continue to enjoy free calls with Google Voice and either port your number now, or move to a new free Google Voice number?

Categories:

Presenting....My Resignation Letter

by Rob 1. May 2011 19:40

This is a bit premature and still in 'beta'; but I think I've finished up my resignation letter.

You can play it here.

Source available here.

Categories: