Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
KiXtart KiXtart Version = 4.53 KiXGolf Script = kixgolf_ts.kix
Computer OS = Windows XP Professional CPU = Intel Pentium Model 13 Speed = 599 MHz Memory = 1024 MB
KiXGolf Scoring Engine Scoring Engine = 3.3
KiXtart Golf Score Tournament = Top Secret Processing Start = 2007/08/09 19:22:03.441 Processing End = 2007/08/09 19:22:03.491 Duration = 0000/00/00 00:00:00.049 KiXGolf Result = Solution passed all 18 tests KiXGolf Score = 425
Thank you for participating in KiXtart Golf!
Code:
; begin Top Secret
;
;!
Function a($f,$b,$c,$d)
dim $, $g, $o, $j, $m
$=createobject("VBscript.RegExp")
$.Pattern="\W|\d"
$.Global=1
$o=$.replace($c,"")
$c=$.Execute($c)
do
$j=split($b,",")
for $g=1 to $f
if $f>($o^)
if $g>($o^)
$.Pattern=""+$g+",?"
$b=$.replace($b,"")
$m=1+$m
endif
else
$a=$a+substr($o,iif($d="E",$j[$g-1],ascan($j,$g)+1),1)
endif
next
if $m=0
$o=right($o,-$f)
endif
$f=$f-$m
$m=0
until $o=""
for each $ in $c
$m=$.FirstIndex
$a=left($a,$m)+ $.value + substr($a,$m+1)
EndFunction
;!
;!
; end Top Secret
KiXtart
KiXtart Version = 4.53
KiXGolf Script = kixgolf_ts.kix
Computer OS = Windows XP Professional CPU = Intel Pentium Model 13 Speed = 797 MHz Memory = 1014 MB
KiXGolf Scoring Engine Scoring Engine = 3.3
KiXtart Golf Score Tournament = Top Secret Processing Start = 2007/08/09 22:56:23.781 Processing End = 2007/08/09 22:56:24.375 Duration = 0000/00/00 00:00:00.593 KiXGolf Result = Solution passed all 20 tests KiXGolf Score = 354
Thank you for participating in KiXtart Golf!
code:
; begin Top Secret
;
;!
Function a($l,$b,$c,$d)
/*
1) the block length
2) the permutation
3) the message to be encoded or decoded
4) a parameter denoting encoding (E) or decoding (D)
*/
dim $i,$o[($c^)],$g,$,$r,$k
for $i=0 to ($c^)
$=substr($c,$i+1,1)
$a=asc(ucase($))
if $a>64 & $a<91
$g=$g+1
$k=$k+$
$r=$r+" "+$i
endif
$o[$i]=$
if $g=$l | $i=($c^)
for each $a in split($b,",")
if $i+$a-$g-1<($c^)
$=$+" "+$a
endif
next
$=split($)
for $a=1 to $g
$o[split($r)[iif($d=E,$a,$[$a])]]=substr($k,iif($d=E,$[$a],$a),1)
next
redim $r,$g,$k
$a=join($o,'')
EndFunction
;!
;!
; end Top Secret
Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
Jooel's code trimmed down to 347 by changing: $a=asc(ucase($)) if $a>64 & $a<91
to
$a=lCase($) if $a>` & $a<}
; begin Top Secret ; ;! Function a($l,$b,$c,$d) /* 1) the block length 2) the permutation 3) the message to be encoded or decoded 4) a parameter denoting encoding (E) or decoding (D) */
dim $i,$o[($c^)],$g,$,$r,$k for $i=0 to ($c^) $=substr($c,$i+1,1) $a=lcase($) if $a>` & $a<} $g=$g+1 $k=$k+$ $r=$r+" "+$i EndIf $o[$i]=$ if $g=$l | $i=($c^) for each $a in split($b,",") if $i+$a-$g-1<($c^) $=$+" "+$a EndIf Next $=split($) for $a=1 to $g $o[split($r)[iif($d=E,$a,$[$a])]]=substr($k,iif($d=E,$[$a],$a),1) Next redim $r,$g,$k $a=join($o,'') EndFunction ;! ;! ; end Top Secret
KiXtart KiXtart Version = 4.52 KiXGolf Script = kixgolf_ts.kix
Computer OS = Windows XP Professional CPU = Intel Pentium Model 13 Speed = 2261 MHz Memory = 1024 MB
KiXGolf Scoring Engine Scoring Engine = 3.3
KiXtart Golf Score Tournament = Top Secret Processing Start = 2007/08/10 11:00:43.296 Processing End = 2007/08/10 11:00:43.328 Duration = 0000/00/00 00:00:00.031 KiXGolf Result = Solution passed all 18 tests KiXGolf Score = 347
Thank you for participating in KiXtart Golf!
Edited by DrillSergeant (2007-08-1011:16 AM) Edit Reason: added score