School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!
Welcome to Dream.In.Code
Become an Expert!

Join 340,136 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 3,923 people online right now. Registration is fast and FREE... Join Now!



My 2 Minutes of Fame

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

My 2 Minutes of Fame Share yours.

#1 AdamSpeight2008  Icon User is offline

  • The Bandido Coder
  • Icon
  • View blog
  • Group: Moderators
  • Posts: 3,289
  • Joined: 29-May 08


Dream Kudos: 4050

Expert In: vb.net, LINQ

Posted 29 August 2009 - 10: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.
Was This Post Helpful? 0
  • +
  • -


#2 Amadeus  Icon User is online

  • g+ + -o drink whiskey.cpp
  • Icon
  • View blog
  • Group: Alumni
  • Posts: 13,376
  • Joined: 12-July 02


Dream Kudos: 25

Posted 30 August 2009 - 04:23 AM

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

#3 Core  Icon User is online

  • Jasper
  • Icon
  • View blog
  • Group: Admins
  • Posts: 3,480
  • Joined: 08-December 08


Dream Kudos: 975

Expert In: .NET Framework

Posted 30 August 2009 - 04: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
  • Icon
  • View blog
  • Group: Author w/DIC++
  • Posts: 5,555
  • Joined: 20-February 09


Dream Kudos: 1675

Posted 30 August 2009 - 04:31 AM

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

#5 SixOfEleven  Icon User is offline

  • XNA Developer
  • Icon
  • View blog
  • Group: Moderators
  • Posts: 4,013
  • Joined: 18-October 08


Dream Kudos: 1100

Expert In: C, C#, XNA, Game Programming, Programming Concepts

Posted 30 August 2009 - 05:02 AM

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

#6 NeoTifa  Icon User is offline

  • 1-800-NEO-ROXS
  • Icon
  • View blog
  • Group: Authors
  • Posts: 7,603
  • Joined: 24-September 08


Dream Kudos: 150

Posted 30 August 2009 - 06:10 AM

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

#7 gabehabe  Icon User is offline

  • Black Scatmaster
  • Icon
  • View blog
  • Group: Alumni
  • Posts: 9,048
  • Joined: 06-February 08


Dream Kudos: 3300

Expert In: Lots of things.

Posted 30 August 2009 - 06: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

  • 1-800-NEO-ROXS
  • Icon
  • View blog
  • Group: Authors
  • Posts: 7,603
  • Joined: 24-September 08


Dream Kudos: 150

Posted 30 August 2009 - 06:35 AM

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

#9 KYA  Icon User is online

  • while(sad){!sad; awesome();}
  • Icon
  • View blog
  • Group: Mentors
  • Posts: 13,183
  • Joined: 14-September 07


Dream Kudos: 3000

Expert In: C, C++, Java

Posted 30 August 2009 - 06: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

  • The Bandido Coder
  • Icon
  • View blog
  • Group: Moderators
  • Posts: 3,289
  • Joined: 29-May 08


Dream Kudos: 4050

Expert In: vb.net, LINQ

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.
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 - 07:28 AM

Was This Post Helpful? 0
  • +
  • -

#11 AdamSpeight2008  Icon User is offline

  • The Bandido Coder
  • Icon
  • View blog
  • Group: Moderators
  • Posts: 3,289
  • Joined: 29-May 08


Dream Kudos: 4050

Expert In: vb.net, LINQ

Posted 30 August 2009 - 07: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: 32
Manipulating them for a while i happen to catch glimpse of an of "s"
Settings:Attached File  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: Attached File  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

Was This Post Helpful? 0
  • +
  • -

#12 poncho4all  Icon User is offline

  • Debugging the Future!
  • Icon
  • Group: Contributors
  • Posts: 1,270
  • Joined: 15-July 09


Dream Kudos: 75

Posted 30 August 2009 - 09:26 AM

Wow f3

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

#13 Martyr2  Icon User is offline

  • Programming Theoretician
  • Icon
  • View blog
  • Group: Mentors
  • Posts: 7,676
  • Joined: 18-April 07


Dream Kudos: 0

Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

Posted 30 August 2009 - 09: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

  • The Bandido Coder
  • Icon
  • View blog
  • Group: Moderators
  • Posts: 3,289
  • Joined: 29-May 08


Dream Kudos: 4050

Expert In: vb.net, LINQ

Posted 31 August 2009 - 11:28 PM

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: 31 August 2009 - 11:43 PM

Was This Post Helpful? 0
  • +
  • -

#15 christinahelton  Icon User is offline

  • D.I.C Head
  • PipPip
  • Group: Members
  • Posts: 84
  • Joined: 16-June 09


Dream Kudos: 0

Posted 01 September 2009 - 03:06 AM

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

#16 gabehabe  Icon User is offline

  • Black Scatmaster
  • Icon
  • View blog
  • Group: Alumni
  • Posts: 9,048
  • Joined: 06-February 08


Dream Kudos: 3300

Expert In: Lots of things.

Posted 01 September 2009 - 04:32 AM

I think you and martyr should have a code-off. Can we have a contest to find the best programmer on DIC or something? Winner gets a shiny badge or something.

This post has been edited by gabehabe: 01 September 2009 - 04:32 AM

Was This Post Helpful? 0
  • +
  • -

#17 AdamSpeight2008  Icon User is offline

  • The Bandido Coder
  • Icon
  • View blog
  • Group: Moderators
  • Posts: 3,289
  • Joined: 29-May 08


Dream Kudos: 4050

Expert In: vb.net, LINQ

Posted 01 September 2009 - 06:16 AM

A bit like a Dance Off but Geekier?
Was This Post Helpful? 0
  • +
  • -

#18 Gloin  Icon User is offline

  • Expert Schmexpert...
  • Icon
  • Group: Mentors
  • Posts: 4,130
  • Joined: 04-August 08


Dream Kudos: 75

Posted 01 September 2009 - 06:22 AM

View PostAdamSpeight2008, on 1 Sep, 2009 - 02:16 PM, said:

A bit like a Dance Off but Geekier?


More like, nothing like a Dance Off, just Geekier?
Was This Post Helpful? 0
  • +
  • -

#19 gabehabe  Icon User is offline

  • Black Scatmaster
  • Icon
  • View blog
  • Group: Alumni
  • Posts: 9,048
  • Joined: 06-February 08


Dream Kudos: 3300

Expert In: Lots of things.

Posted 01 September 2009 - 06:29 AM

Exactly like a dance off. You should record yourselves typing the code, and see who has the most rhythm whilst typing it.
Was This Post Helpful? 0
  • +
  • -

#20 sbell1099  Icon User is offline

  • The Real Webmaster
  • PipPipPipPip
  • View blog
  • Group: Members
  • Posts: 610
  • Joined: 28-October 08


Dream Kudos: 100

Posted 01 September 2009 - 06:57 AM

or you could lend my streaming media servers for a hour then let a judge panel watch u both in real time :) no cheating then

This post has been edited by sbell1099: 01 September 2009 - 06:57 AM

Was This Post Helpful? 0
  • +
  • -

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


Fast Reply

  

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month