Inside F#

Brian's thoughts on F# and .NET

A programming problem, part one (place your bets!)

Posted by Brian on October 5, 2008

I was trying to come up with a programming problem to motivate some blog entries, and I found one that I really like.  Ruby Quiz #24 requires you to write a short console application that reads in information about Texas Hold ‘Em poker hands, evaluates the results, and prints out the results.  Follow the link and go check the problem out.

I like this problem because

  • It is simple to read and understand (the spec is a little thin/lax, but the main idea is straightforward and obvious).
  • It is deceptively complex – this is not a program you will knock out in 20 minutes of coding (but please try to prove me wrong!).
  • It can be solved with a few different implementation strategies.
  • It does not require much domain-specific knowledge (just cards and poker – a complete list of what-beats-what is here; unlike the link in the problem, this link includes important tiebreaker information).
  • It is fun!  I used to play No Limit Hold ‘Em a bit, and enjoyed it, but never got good at it (and not for lack of trying).  So for me, there’s a bit of a nostalgia aspect here.

So in the next few blog entries, I will walk through solving this problem.  And here’s the kicker (pun!) – I intend to show you two different ways to do it.  Why?  And what differentiates the two ways?  You’ll find out in due time.  In the meantime, try your own hand (not so much a pun) at the problem, using any language or implementation strategy you like.  That way you’ll have something of your own to compare against the solutions I present.

Get crackin’!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: