Monday, February 25, 2008

Sudden Death Challenge Event 4

I didn't compete in any of the first 3 Sudden Death Events as I didn't have enough time at work to even look at them. As time permitted I was however able to do the last few of them. Here is my solution to the Event 4 of the SD Challenge.

   1:  $line=gc c:\Scripts\numbers.txt
   2:  for ($i=0;$i -le 20; $i+=2) {$word+=[char][int]$line.Substring($i,2)}
   3:  $word

Pretty simple actually. Using the "for" statement to grab every 2 numbers which is the "ASCII Code" equivalent to the letters we want. The first 2 numbers "68" is the "ASCII Code" for "D". The next 2 numbers "82" is the "ASCII Code" for "R", and so on, and so on.

So this:


Turns into this:


No comments: