#203713 - 2011-11-14 11:22 PM 
 
Re: Kixgolf - Whitespace Obfuscation - Public Round
[Re:  Lonkero]
 | 
 
Jochen 
 
 
KiX Supporter
 
     
 
 
 
Registered:  2000-03-17
 
Posts: 6380
 
Loc:  Stuttgart, Germany
 | 
 |  
| 
Top
 | 
 | 
 
 
 | 
 
 
 | 
 
 
#203719 - 2011-11-15 01:24 PM 
 
Re: Kixgolf - Whitespace Obfuscation - Public Round
[Re:  Lonkero]
 | 
 
Howard Bullock 
 
 
KiX Supporter
 
     
 
 
 
Registered:  2000-09-15
 
Posts: 5809
 
Loc:  Harrisburg, PA USA
 | 
My code did work. I was fussing with it near the end trying to cut more. I must have not reverted it back before posting. Please except my apologies. I will locate the working and post it shortly.
 
 |  
| 
Top
 | 
 | 
 
 
 | 
 
 
 | 
 
 
#203720 - 2011-11-15 01:25 PM 
 
Re: Kixgolf - Whitespace Obfuscation - Public Round
[Re:  Lonkero]
 | 
 
Howard Bullock 
 
 
KiX Supporter
 
     
 
 
 
Registered:  2000-09-15
 
Posts: 5809
 
Loc:  Harrisburg, PA USA
 | 
You are usingan older version of KiXtart.  Trying using 4.62.
 
 |  
| 
Top
 | 
 | 
 
 
 | 
 
 
 | 
 
 
#203721 - 2011-11-15 01:45 PM 
 
Re: Kixgolf - Whitespace Obfuscation - Public Round
[Re:  Howard Bullock]
 | 
 
Howard Bullock 
 
 
KiX Supporter
 
     
 
 
 
Registered:  2000-09-15
 
Posts: 5809
 
Loc:  Harrisburg, PA USA
 | 
I must have introduced a non-printable character into the code somehow. I re-copied the code form his post and re-edited it.  function a($, optional $k,$e,$m)
    $k=$k+$<' '
    $m=' ','	'
    $e=$<!
    while $
        dim $c,$n,$x
        $x=asc($)
        $n=128
        while $n
            $c=$c+iif($e,$n*(($k^$<' ')&$>),$m[$k^$x/$n])
            $x=$x-$n*($x/$n)
            $n=$n/2
            $=iif($e|$n=0,right($,~),$)
        loop
        $a=$a+iif($e,chr($c),$c+iif($,@,$m[$k]))
endfunction   
   KiXtart Version  = 4.62
KiXGolf Script   = kixgolf_wo.kix
Scoring Engine   = 3.3
OS               = Windows 7 Professional Edition
CPU              = Intel Pentium Celeron
Speed            = 2394 MHz
Memory           = 4096 MB
Tournament       = Whitespace Obfuscation
Processing Start = 2011/11/15 07:32:13.205
Processing End   = 2011/11/15 07:32:13.423
Duration         = 0000/00/00 00:00:00.217
# Tests Run      = 40
# Tests Passed   = 40
# Tests Failed   = 0
Result           = Passed
KiXGolf Score    = 245
Thank you for participating in KiXtart Golf!    
  As for my code, it is now repaired. I used my editor to change TABS to spaces for better formatting. That alters the TAB I used in the code as well. Sorry for the error.  function a($s, optional $k,$,$c,$e,$p,$z)
  $z=1,128,64,32,16,8,4,2,1
  For $c=1 To ($s^)
    $p=substr($s,$c,1)
    if $k
      ;Encode
      For $=1 to 8
        $a=$a+iif(asc($p) & $z[$], iif($k=" ","	"," "), $k)
      Next
    else
      ;Decode
      $=$c mod 8
      $e=$z[$]*(right($s,1)<>$p)+$e
      if $=0
        $a=$a+chr($e)
        $e=0
      endif
    endif
  Next
  $a=$a+$k
endfunction   KiXtart Version  = 4.62
KiXGolf Script   = kixgolf_wo.kix
Scoring Engine   = 3.3
OS               = Windows 7 Professional Edition
CPU              = Intel Pentium Celeron
Speed            = 2394 MHz
Memory           = 4096 MB
Tournament       = Whitespace Obfuscation
Processing Start = 2011/11/15 07:44:24.959
Processing End   = 2011/11/15 07:44:25.099
Duration         = 0000/00/00 00:00:00.139
# Tests Run      = 40
# Tests Passed   = 40
# Tests Failed   = 0
Result           = Passed
KiXGolf Score    = 255
Thank you for participating in KiXtart Golf!   
 
 |  
| 
Top
 | 
 | 
 
 
 | 
 
 
 | 
 
 
#203725 - 2011-11-15 08:29 PM 
 
Re: Kixgolf - Whitespace Obfuscation - Public Round
[Re:  Lonkero]
 | 
 
ShaneEP 
 
 
MM club member
 
     
 
 
 
Registered:  2002-11-29
 
Posts: 2127
 
Loc:  Tulsa, OK
 | 
Well my 500ish code doesn't work anymore with the new cases, and i don't really have the time to work on it. but i can post it anyways. I doubt there is anything in it of value though.
 
 function a($, optional $k,$b,$x,$z)
   if asc($)=32 or asc($)=9
      $k = right($,1)
      $ = Replace($,$k,0)
      $x = iif($k='	',' ','	')
      $ = Replace($,$x,1)+$k
      for $x=0 to len($)/8
         $b=$b+' '+substr($,$x*8+1,8)
      next
      for each $x in Split($b)
         $b = 128
         $=0
         for $z=1 to 8
            $ = $+$b*substr($x,$z,1)
            $b = $b/2
         next
         $a = $a+Chr($)
      next
   else
      $b = asc($)
      for $x=1 to len($)-1
         $b=''+$b+' '+asc(right($,-$x))
      next
      for each $x in Split($b)
         $ = 128
         for $z=1 to 8
            if $<=$x
               $a = $a+"1"
               $x = 0+$x-$
            else
               $a = $a+"0"
            endif
            $ = $/2
         next
      next
      $a = Replace($a,0,$k)
      $ = iif($k="	"," ","	")
      $a = Replace($a,1,$)+$k
endfunction 
 
 |  
| 
Top
 | 
 | 
 
 
 | 
 
 
 | 
 
 
#203728 - 2011-11-15 08:47 PM 
 
Re: Kixgolf - Whitespace Obfuscation - Public Round
[Re:  Lonkero]
 | 
 
Lonkero 
 
 
KiX Master Guru
 
     
 
 
Registered:  2001-06-05
 
Posts: 22346
 
Loc:  OK
 | 
I see you turned it to an array and then used for each. substr() would have got you there without the need for that and with ~100 strikes shorter...
  anyways, your code fixed and shorther, 489 -> 475
 
function a($, optional $k,$b,$x,$z)
;   if asc($)=32 or asc($)=9
if not $k
      $k = right($,1)
      $ = Replace($,$k,0)
      $x = iif($k='	',' ','	')
      $ = Replace($,$x,1)+$k
      for $x=0 to len($)/8
         $b=$b+' '+substr($,$x*8+1,8)
      next
      for each $x in Split($b)
         $b = 128
         $=0
         for $z=1 to 8
            $ = $+$b*substr($x,$z,1)
            $b = $b/2
         next
         $a = $a+Chr($)
      next
   else
      $b = asc($)
      for $x=1 to len($)-1
         $b=''+$b+' '+asc(right($,-$x))
      next
      for each $x in Split($b)
         $ = 128
         for $z=1 to 8
            if $<=$x
               $a = $a+"1"
               $x = 0+$x-$
            else
               $a = $a+"0"
            endif
            $ = $/2
         next
      next
      $a = Replace($a,0,$k)
      $ = iif($k="	"," ","	")
      $a = Replace($a,1,$)+$k
endfunction
 
_________________________ 
!download  KiXnet
 
 
 |  
| 
Top
 | 
 | 
 
 
 | 
 
 
 | 
 
 
 
 
Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart  
 | 
 
1 registered
(Allen)
and 430 anonymous users online. 
 | 
 
 
 | 
 
 
 |