So excited!
My 2 Minutes of Fame
My 2 Minutes of Fame Share yours.
#10
Posted 30 August 2009 - 06:44 AM
It solves the unsolved Hard Hat Challenge from PDC2008.
When challenge was set.
Challege remaining unsolved
The first two code listings where based on of a hand conversion to text of this picture.
(It has transcription errors, but was close enough for me to guess with a very high confidence it was correct.)
That when I first posted to solution, without the code method.

The last one takes the octet data straight of the image, and is my favorite.
Note: The Output textbox requires scrollbar and a mono-spaced font.
This is about as small as I can get it.
When challenge was set.
Challege remaining unsolved
The first two code listings where based on of a hand conversion to text of this picture.
(It has transcription errors, but was close enough for me to guess with a very high confidence it was correct.)
That when I first posted to solution, without the code method.
The last one takes the octet data straight of the image, and is my favorite.
Note: The Output textbox requires scrollbar and a mono-spaced font.
This is about as small as I can get it.
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 p() As Single = {73, 21, 74, 46, 63, 0, 0} 'XPos, XStep, YPos, YStep, XGap, Base, RowStart
For col = 0 To 5
p(2) = 74 : p(6) = p(0) + p(5)
For row = 0 To 19
Dim PixelBits = 0
p(0) = p(6)
For octetBit = 7 To 0 Step -1
Dim pc = bmp.GetPixel(p(0), p(2))
If pc.A = 255 AndAlso pc.R = 255 AndAlso pc.B = 255 AndAlso pc.G = 255 Then PixelBits += (2 ^ octetBit)
bmp.SetPixel(p(0), p(2), Color.YellowGreen)
p(0) += p(1)
Next
Bytes.Add(PixelBits)
p(2) += p(3)
Next
p(5) = p(4) - p(1)
Next
Me.Pic_Image.Image = bmp
Dim PiDigit As String = My.Resources.PI.Replace(ControlChars.NewLine, "")
Dim i As Integer = -1
Me.Output.Text = (From T In Bytes _
Select Convert.ToString(ROR(T, Integer.Parse(PiDigit(LinqIndex(i))) - 1), 2).PadLeft(8, "0")) _
.Aggregate(Function(current, nexta) current & ControlChars.NewLine & nexta) _
.ToString.Replace("1", " ").Replace("0", "#")
End Sub
Private Function LinqIndex(ByRef xi) As Integer
xi += 1 : Return xi
End Function
Private Function ROR(ByVal x, ByVal r) As Byte
While r >= 0
x = ((x And &H80) >> 7) + ((x And &H7F) << 1)
r -= 1
End While
Return x
End Function
End Class
This post has been edited by AdamSpeight2008: 30 August 2009 - 07:28 AM
#11
Posted 30 August 2009 - 07:08 AM
KYA, on 30 Aug, 2009 - 02:36 PM, said:
Was there a jumping point at all or did they just hand the image out and say "find the secret message"?
None: Just the clues you could glean from the first video. Not even a direction to read the sequence.
@NeoTifa: You can why it lasted a year! I only took the challenge on the second video posting.
@gabehabe: I think it took me about 6-7 hours of coding. (2Hrs+ for the conversion to text.)
I took sometime out to do other things, like eat, sleep and bathe.
During that time did write serveral throwaways,
The first had lots of controls i could manipulation the different thoughts I had on it. (I might attach it)
This:
WindowsApplication42.zip (95.91K)
Number of downloads: 32
Manipulating them for a while i happen to catch glimpse of an of "s"
Settings:
s.txt (52bytes)
Number of downloads: 16
+ Use PI Offset = True
The second was a rewrite just using those settings.
The third version was a refinement and tidy up of the code.
Submitted:
PDC2008_ApplePie_Solution.zip (80.69K)
Number of downloads: 31
The fourth simplified the code by using LINQ
The fifth and final was the directly extracting the octet byte out of the image.
This post has been edited by AdamSpeight2008: 30 August 2009 - 07:31 AM
#14
Posted 31 August 2009 - 11:28 PM
It also possible to do the solution manually.
For the full text with cut points. Modify the code so the output.text is.
It possible to compress that to 3 line of code (I think a single line solution to this part maybe possible using LINQ).
Edit: Thought so. (1 Line)
- Print out the image
- Label the columns Left to Right Rotate (Their positions rotated anticlockwise) A B C D E F
- Cut out the columns. (Ask a responsiable adult to do this for you.)
- Write on the righthand side of each, column row the corrisponding digit of PI (What they ate.)
- So the first few are 3, 1, 4, 1. 5, 9 etc
- Cut out row 1 of column A.
- Cut out the first 3 digits (Take One if doing on computer (Off by one))
- Note: 1 -> 1 digits etc, 0 & 8 -> 0 digts, 9 ->1digit. (Eg Row A1 = [001] [10000] )
- Glue the two peices to another peice of paper. First part last. (Eg Row A1 = [10000] [001] )
- Repeat step 6 - 9 for the other rows and columns.
- Stand back about from it & squint.
- On the answer is spelt out vertically.
[001][10000] [10000][001] [.####][##.] [0][0011110] [0011110][0] [##....#][#] [1111][0011] [0011][1111] [##..][....] [1][1000000] [1000000][1] [.######][ ] [11100][111] [111][11100] [...][...##] [0][0011110] [0011110][0] [##.....][#] [01][100000] [100000][01] [.#####][#.] [000000][00] [00][000000] [..][......]
For the full text with cut points. Modify the code so the output.text is.
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 = o
It possible to compress that to 3 line of code (I think a single line solution to this part maybe possible using LINQ).
Edit: Thought so. (1 Line)
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", "#")
This post has been edited by AdamSpeight2008: 31 August 2009 - 11:43 PM

Start a new topic
Add Reply



MultiQuote








| 


