Countdown to PDC09: Hard Hat Challenges Are Back! (Sort of)
- Posted: Aug 27, 2009 at 5:31 AM
- 43,030 Views
- 26 Comments
Download
How do I download the videos?
- To download, right click the file type you would like and pick “Save target as…” or “Save link as…”
Why should I download videos from Channel9?
- It's an easy way to save the videos you like locally.
- You can save the videos in order to watch them offline.
- If all you want is to hear the audio, you can download the MP3!
Which version should I choose?
- If you want to view the video on your PC, Xbox or Media Center, download the High Quality WMV file (this is the highest quality version we have available).
- If you'd like a lower bitrate version, to reduce the download time or cost, then choose the Medium Quality WMV file.
- If you have a Zune, WP7, iPhone, iPad, or iPod device, choose the low or medium MP4 file.
- If you just want to hear the audio of the video, choose the MP3 file.
Right click “Save as…”
- High Quality WMV (PC, Xbox, MCE)
- MP3 (Audio only)
- MP4 (iPod, Zune HD)
- Mid Quality WMV (Lo-band, Mobile)
- WMV (WMV Video)
Do you easily get car sick? If so, you’re in for a ride as Mike and Jennifer go mobile and take their show on the road this week. This episode includes the return of the Hard Hat Challenge, starting with the apple pie puzzle from last year that remains unsolved to this day. But there are other ways to win! Enter the INETA coding challenge and you may win a free ticket to PDC. Additional updates on sessions, hotels, PDC Classics and more are covered in this show, that’s very much on the go.
Comments Closed
Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation,
please create a new thread in our Forums,
or
Contact Us and let us know.
Follow the Discussion
Sleeping in your car?!?
Congratulations, you just won a 'internal only' PDC poster.
EDIT: link to Ineta in the video is wrong.
Darn, commented then clicked refresh... *tear*
Cool!
There is no link to the blog post about embeding the pdc font into the SL app
Good catch. Here's a link to David Isbitski's post.
And by the way, nobody in this thread has answered the challenge correctly yet. The poster is for the first correct answer.
New to the hard hat challenges here, but sounded fun. =) I'm pretty sure I'm on the right track... *pretty* sure... lol.
-Stephen
Yeah, nevermind. lol. The quest for the solution continues! I was focusing on groupings of 7 and dot matrix... and somehow fitting in pi along with the fact that you switched positions before showing it. Maybe that'll help someone else... or throw them completely off. lol.
-Stephen
Is the vertical line in the first column, second row meaningful or not? It's on the picture you posted but not on the PDC 2008 video and just wondering.
I see a pretty strong pattern that happens 5 times with certain rows "off by one" but I can't find any use for it. Seems to validate the empty cell at the end, but I can't find any way to relate it to Pie or Pi. Time for dinner, so I guess I'll have to try again in the morning.
To tell you the truth, I never noticed that small vertical line. I can confirm that it's not important at all.
Does the sequence go left to right then next line? or Left column top to bottom Next Column?
Let's see if this is right.
Is the answer: NOIZE ?
Used letter - number subsitution with the numer of PI
Looks like a bunch of punch cards. http://en.wikipedia.org/wiki/Punch_card
print them out, rotate back and forth and you get I ♥ PDC
Sorry, CKurt...that isn't the correct answer. Sadly, ivan_, your answer isn't correct either.
To answer Adam's question, the order is left column, top-to-bottom, next column, top-to-bottom, etc.
Hmm... every seven rows there is a blank row so there must some pattern, now just have decode it
And what's more, the groups are very symetrical in a vertical way. What I mean is that if a group of seven row begins with a row which has 6 black dots, it also ends with a row with 6 black dots... hmm...
Solved it:
It says SEE YOU AT PDC2008.
I'll post method later.
As promised the method. (Note: The zipped up solution is also available in the SandBox)
Make sure that the textbox is using a Monospaced font, has Multiline and Scrollbars=Vertical
Public Class Form1 Private Sub ShowSolution(ByRef useThisTextBox As TextBox) ' Initialise and array of string lists. Dim columns(6) As List(Of String) For i As Integer = 0 To 6 : columns(i) = New List(Of String) : Next ' Get Digits of PI Dim piStr As String = My.Resources.pi.Replace(Environment.NewLine, "") ' Get PDC Image text representation. Dim tfp As New FileIO.TextFieldParser("Resources/PDC2008.txt") Dim del() As String = {" "} tfp.Delimiters = del While tfp.EndOfData = False Dim f() = tfp.ReadFields ' Place field into correct column. For i As Integer = 0 To f.Count - 1 columns(i).Add(f(i)) Next End While tfp.Close() ' Collate the columns into a single column. For i As Integer = 0 To 5 columns(6).AddRange(columns(i).ToArray) Next ' Rotate Left by corrisponding PI digit For i As Integer = 0 To columns(6).Count - 1 For j As Integer = 0 To Integer.Parse(piStr(i)) columns(6)(i) = STR_ROR(columns(6)(i), False) Next Next ' Rotate To Right. For i As Integer = 0 To columns(6).Count - 1 columns(6)(i) = STR_ROR(columns(6)(i), True) Next ' Build the output string. useThisTextBox.Text = "" For i As Integer = 0 To columns(6).Count - 1 useThisTextBox.Text &= columns(6)(i) & ControlChars.NewLine Next ' Hide the ones. useThisTextBox.Text = Me.TextBox1.Text.Replace("1", " ") ' Replace 0 with # for higher contrast useThisTextBox.Text = Me.TextBox1.Text.Replace("0", "#") End Sub Private Function STR_ROR(ByVal RotateThisString As String, Optional ByVal RotateToTheRight As Boolean = True) As String ' A function to do the rotation either 1 place to the right, or to the left. If RotateToTheRight Then Return RotateThisString(RotateThisString.Length - 1) & RotateThisString.Substring(0, RotateThisString.Length - 1) Else Return RotateThisString.Substring(1, RotateThisString.Length - 1) & RotateThisString.Substring(0, 1) End If End Function Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load ShowSolution(Me.TextBox1) End Sub End ClassLINQ-ified Shorter Version.
Public Class Form1 Private Sub ShowSolution(ByRef useThisTextBox As TextBox) ' Initialise and array of string lists. Dim columns(6) As List(Of String) For i As Integer = 0 To 6 : columns(i) = New List(Of String) : Next ' Get Digits of PI Dim piStr As String = My.Resources.pi.Replace(Environment.NewLine, "") ' Get PDC Image text representation. Dim tfp As New FileIO.TextFieldParser("Resources/PDC2008.txt") Dim del() As String = {" "} tfp.Delimiters = del While tfp.EndOfData = False Dim f() = tfp.ReadFields ' Place field into correct column. For i As Integer = 0 To f.Count - 1 : columns(i).Add(f(i)) : Next End While tfp.Close() ' Collate the columns into a single column. For i As Integer = 0 To 5 : columns(6).AddRange(columns(i).ToArray) : Next ' Rotate Left by corrisponding PI digit minus one to rotate right For i As Integer = 0 To columns(6).Count - 1 : columns(6)(i) = STR_ROR(columns(6)(i), False, Integer.Parse(piStr(i))- 1) : Next ' Build the output string. Hide the ones. Replace 0 with # for higher contrast useThisTextBox.Text = ((From T As String In columns(6) Select T).Aggregate( _ Function(current As String, nexta As String) current + ControlChars.NewLine + nexta)) _ .Replace("1", " ").Replace("0", "#") End Sub Private Function STR_ROR(ByVal RotateThisString As String, _ Optional ByVal RotateToTheRight As Boolean = True, _ Optional ByVal repeats As Integer = 0) As String ' A function to do the rotation either 1 place to the right, or to the left. While repeats >= 0 If RotateToTheRight Then RotateThisString = RotateThisString(RotateThisString.Length - 1) & RotateThisString.Substring(0, RotateThisString.Length - 1) Else RotateThisString = RotateThisString.Substring(1, RotateThisString.Length - 1) & RotateThisString.Substring(0, 1) End If repeats -= 1 End While Return RotateThisString End Function Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load ShowSolution(Me.TextBox1) End Sub End ClassGet Byte values Directly From image
Using the image found via link in a previous post.
Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim bmp As New Bitmap(My.Resources.PDC2008_Hard_Hat_Challenge_8) Dim Bytes As New List(Of Byte) Dim XPos As Single = 73 Dim XStep As Single = 21 Dim YPos As Single = 74 Dim YStep As Single = 46 Dim XGap As Single = 63 Dim PixelBits As Byte = 0 Dim Base As Single = 0 For col As Integer = 0 To 5 YPos = 74 Dim RowStart = XPos + Base For row As Integer = 0 To 19 PixelBits = 0 XPos = RowStart For octetBit As Integer = 7 To 0 Step -1 Dim pc = bmp.GetPixel(XPos, YPos) If pc.A = 255 AndAlso pc.R = 255 AndAlso pc.B = 255 AndAlso pc.G = 255 Then PixelBits += (2 ^ octetBit) bmp.SetPixel(XPos, YPos, Color.YellowGreen) XPos += XStep Next Bytes.Add(PixelBits) YPos += YStep Next Base = XGap - XStep Next Me.Pic_Image.Image = bmp Bytes.RemoveAt(119) Dim FinalStr As New System.Text.StringBuilder Dim PiDigit As String = My.Resources.pi.Replace(ControlChars.NewLine, "") For i As Integer = 0 To Bytes.Count - 1 Bytes(i) = ROR(Bytes(i), Integer.Parse(PiDigit(i)) - 1) FinalStr.AppendLine(ByteToStr(Bytes(i))) Next Me.Output.Text = FinalStr.ToString.Replace("1", " ").Replace("0", "#") End Sub Private Function ByteToStr(ByVal x As Byte) As String Dim r As String = "" For i As Integer = 7 To 0 Step -1 r &= If(((2 ^ i) And x) > 0, "1", "0") Next Return r End Function Private Function ROR(ByVal x As Byte, ByVal r As Integer) As Byte While r >= 0 x = ((x And &H80) >> 7) + ((x And &H7F) << 1) r -= 1 End While Return x End Function End ClassGreat job and congratulations, Adam! That puzzle had gone unsolved for quite a long time. Drop us an e-mail at pdc09@microsoft.com with your name and mailing address, and we'll get one of our internal PDC09 posters sent to you. Thanks for sharing the method you used to solve the puzzle.
I'm working on a new Hard Hat Challenge, and I hope I can finish it for this week's episode.
Thank you, I've sent the email and if you want to "ruin" the poster it upto you.
Sadly I won't be attending PDC2009 in body but I'll be there in spirit and vicariously through the sessions webcasts.
Maybe I'll go sometime in the future.
Have a great PDC2009.
Edit: Topic Posting as </Dream.In.Code> containing
A description of the effort.
Yes, congratulations!
I'm just wondering, how this could be solved on paper as you mentioned in last years PDC video comment
Whoops! Typo in the video for INETA url for Code Challenge. The correct url is: ineta.org/codechallenge
I'm dissapointed. I think Tommy needs more camera time!
To do it manually. You need sheets of Paper, Scissors, Pen and Glue.
Follow this method.
Simples.
The bold are the clues from the video.
Here a the first 8 row with cut corrispoding cut points.
If you interested in the full text with cut points, change the code so the output.text is this.
Dim o As String = "" For q As Integer = 0 To Bytes.Count - 1 Dim rr = Integer.Parse(PiDigit(q)) Mod 8 Dim bs = Convert.ToString(Bytes(q), 2).PadLeft(8, "0") o &= String.Format("[{1}][{0}]{2}", bs.Substring(0, rr), bs.Substring(rr), ControlChars.NewLine) Next Me.Output.Text = oI think this section of code maybe possible to compact this down single line of code. (using LINQ)
It is. (So if you exclude the image extraction code, or you use the manual text file)
Solve in a single line of vb.net (LINQ) code.
Me.Output.Text = ((Bytes.Select(Of String) _ (New System.Func(Of Byte, Integer, String) _ (Function(lb As Byte, li As Integer) _ String.Format("[{1}][{0}]", _ Convert.ToString(Bytes(li), 2).PadLeft(8, "0"). _ Substring(0, Integer.Parse(PiDigit(li)) Mod 8), _ Convert.ToString(Bytes(li), 2).PadLeft(8, "0"). _ Substring(Integer.Parse(PiDigit(li)) Mod 8) _ ) _ ) _ ) _ ).Aggregate( _ Function(current, nexta) current & ControlChars.NewLine & nexta) _ ).ToString.Replace("1", " ").Replace("0", "#")Now I've refactored the code to its limit. I'm stepping away.
Remove this comment
Remove this thread
close