1. Home
  2. Computing & Technology
  3. C / C++ / C#
photo of David Bolton
David's C / C++ / C# Blog

By David Bolton, About.com Guide to C / C++ / C#

The Answer to the Puzzle

Thursday August 7, 2008
The digits were 0,1,2,3,4,5 and 0,1,2,6,7,8 as was correctly spotted. But how does that handle the ninth, nineteenth and 29th? That's the lateral thinking bit- you just turn the 6 upside down! That's not something you would usually do in programming but an approach of "thinking outside the box" can be a useful skill. More generally, if you are both designing and programming, use the two hats approach. You put your metaphorical design hat on first and design the application without thinking how you will implement it. It's a difficult thing to do but it can be done.

Next to code it, you put your programmers hat on. If at some point you think "Why did I design that feature- it will be a real pig to implement" then you know you've mastered the two hats approach! Keeping the design and implementation processes distinct and isolated from each other will reduce compromise and your application will be better for it. I've designed and programmed games this way and the programmer me has hated the design me but I think the games were better for it!

Challenge 14 has been updated with the source code downloads.

Comments
September 8, 2008 at 1:03 am
(1) elle says:

Actually this solution is not quite correct. Zero, unlike 1 and 2, does not need to be duplicated presuming the dice can be switched in order to allow for the combinations 23, 24, and 25 (which would be impossible if the dice had to be static). With the extra zero removed, there is room for a 9 after all.

September 8, 2008 at 2:51 pm
(2) cplus says:

So how do you display 04 or 08? The question did say all dates 01..31. That’s all 10 numbers 01..09.

David

July 9, 2009 at 10:41 pm
(3) Ken says:

I think I have a better answer:

The first die will have 0, 1, 2 each appearing twice.

The second die will have 3, 4, 5, 6, 7, 8.

Whenever you roll the dice you get a legal date, for example: 0, 3 can either be 3 or 30. This also uses your using the 6 as a 9 trick, but it can’t give you illegal dates like your solution. For example, what happens when you roll a 5 and an 8? There is no 58 or 85th date.

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

Discuss
Community Forum
Explore C / C++ / C#
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. C / C++ / C#

©2009 About.com, a part of The New York Times Company.

All rights reserved.