My 2 Minutes of Fame

Share yours.

  • (3 Pages)
  • +
  • 1
  • 2
  • 3

40 Replies - 5974 Views - Last Post: 04 September 2009 - 07:06 AM

#1 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2270
  • View blog
  • Posts: 9,496
  • Joined: 29-May 08

My 2 Minutes of Fame

Posted 29 August 2009 - 11:41 PM

I solved and won the PDC2008 Hard Hat Challenge (aka The Apple Pie Challenge.) .

So excited! :bananaman: I can't wait for my prize.

Is This A Good Question/Topic? 0
  • +

Replies To: My 2 Minutes of Fame

#2 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,507
  • Joined: 12-July 02

Re: My 2 Minutes of Fame

Posted 30 August 2009 - 05:23 AM

Congratulations!
Was This Post Helpful? 0
  • +
  • -

#3 Core  Icon User is offline

  • using System.Linq;
  • member icon

Reputation: 774
  • View blog
  • Posts: 5,097
  • Joined: 08-December 08

Re: My 2 Minutes of Fame

Posted 30 August 2009 - 05:27 AM

Congratulations, Adam! Good job on solving the puzzle!
Was This Post Helpful? 0
  • +
  • -

#4 firebolt  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 92
  • View blog
  • Posts: 5,561
  • Joined: 20-February 09

Re: My 2 Minutes of Fame

Posted 30 August 2009 - 05:31 AM

Very nice piece of coding. Congratulations :^:
Was This Post Helpful? 0
  • +
  • -

#5 SixOfEleven  Icon User is offline

  • using Caffeine;
  • member icon

Reputation: 945
  • View blog
  • Posts: 6,342
  • Joined: 18-October 08

Re: My 2 Minutes of Fame

Posted 30 August 2009 - 06:02 AM

Excellent solution! Very nice thinking.
Was This Post Helpful? 0
  • +
  • -

#6 NeoTifa  Icon User is offline

  • Whorediot
  • member icon





Reputation: 2778
  • View blog
  • Posts: 15,880
  • Joined: 24-September 08

Re: My 2 Minutes of Fame

Posted 30 August 2009 - 07:10 AM

Nice... what does it do?
Was This Post Helpful? 0
  • +
  • -

#7 gabehabe  Icon User is offline

  • GabehabeSwamp
  • member icon




Reputation: 1384
  • View blog
  • Posts: 10,962
  • Joined: 06-February 08

Re: My 2 Minutes of Fame

Posted 30 August 2009 - 07:33 AM

Nice! It'd be even better if it weren't VB. ;)

How long was it before it was actually solved, do you know? He said it had been "quite some time", but didn't really give any sort of measure.
Was This Post Helpful? 0
  • +
  • -

#8 NeoTifa  Icon User is offline

  • Whorediot
  • member icon





Reputation: 2778
  • View blog
  • Posts: 15,880
  • Joined: 24-September 08

Re: My 2 Minutes of Fame

Posted 30 August 2009 - 07:35 AM

A year
Was This Post Helpful? 0
  • +
  • -

#9 KYA  Icon User is online

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3116
  • View blog
  • Posts: 19,154
  • Joined: 14-September 07

Re: My 2 Minutes of Fame

Posted 30 August 2009 - 07:36 AM

Was there a jumping point at all or did they just hand the image out and say "find the secret message"?
Was This Post Helpful? 0
  • +
  • -

#10 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2270
  • View blog
  • Posts: 9,496
  • Joined: 29-May 08

Re: My 2 Minutes of Fame

Posted 30 August 2009 - 07: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.
Attached Image
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 - 08:28 AM

Was This Post Helpful? 0
  • +
  • -

#11 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2270
  • View blog
  • Posts: 9,496
  • Joined: 29-May 08

Re: My 2 Minutes of Fame

Posted 30 August 2009 - 08:08 AM

View PostKYA, 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: Attached File  WindowsApplication42.zip (95.91K)
Number of downloads: 127
Manipulating them for a while i happen to catch glimpse of an of "s"
Settings:Attached File  s.txt (52bytes)
Number of downloads: 189
+ 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: Attached File  PDC2008_ApplePie_Solution.zip (80.69K)
Number of downloads: 116
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 - 08:31 AM

Was This Post Helpful? 0
  • +
  • -

#12 poncho4all  Icon User is offline

  • D.I.C Head!
  • member icon

Reputation: 123
  • View blog
  • Posts: 1,405
  • Joined: 15-July 09

Re: My 2 Minutes of Fame

Posted 30 August 2009 - 10:26 AM

Wow f3

Congratulations xD
Was This Post Helpful? 0
  • +
  • -

#13 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4405
  • View blog
  • Posts: 12,262
  • Joined: 18-April 07

Re: My 2 Minutes of Fame

Posted 30 August 2009 - 10:41 AM

Congratulations! However, I am disturbed that you hadn't mentioned DIC once. How can we be a programming cult if no one spreads the message?!?!

jk. Good work! :)
Was This Post Helpful? 0
  • +
  • -

#14 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2270
  • View blog
  • Posts: 9,496
  • Joined: 29-May 08

Re: My 2 Minutes of Fame

Posted 01 September 2009 - 12:28 AM

It also possible to do the solution manually.
  • 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: 01 September 2009 - 12:43 AM

Was This Post Helpful? 0
  • +
  • -

#15 christinahelton  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 84
  • Joined: 16-June 09

Re: My 2 Minutes of Fame

Posted 01 September 2009 - 04:06 AM

Congrats!
Was This Post Helpful? 0
  • +
  • -

  • (3 Pages)
  • +
  • 1
  • 2
  • 3