k, here is a fixed one.
checked from non-matching tests that jens' cipher is screwed up.
second test, not lcase chars:
K+K-first word = W not 5
I+I-first word = S not 1
so, this seemed to work correctly:
Code:
function vigenere($t,$k,optional $d)
dim $j,$r,$,$p,$o,$y
for $j = 65 to 90
$ = chr($j)+$+chr($j+32)
next
$p = "0123456789"+$
for $j = 1 to len($t)
do
$ = left($k,1)
$k = substr($k,2)+$
$y = instr($p,$)
until $y
$ = substr($t,$j,1)
$o = $o+($=" ") -$o*(0 $r = instr($p,$)
if $r
$ = 62 - (ucase($t+$k)=$t+$k)*26
$ = substr($p,1+($+$r+(2*($d=0)-1)*($y-$o-2)-1) mod $,1)
endif
$vigenere = $vigenere + $
next
endfunction
KiXtart
KiXtart Version = 4.22
KiXforms Version =
KiXGolf Script = kixgolf_vigenere.kix
Computer
OS = Windows 2000 Professional
CPU = Intel Pentium III Mobile
Speed = 933 MHz
Memory = 256 MB
KiXGolf Scoring Engine
Scoring Engine = 3.0.3
KiXtart Golf Score
Tournament = KiXtart Golf: Vigenere Cipher
Valid Cipher Ops = 7 (64%)
Processing Start = 2004/08/02 16:03:15.847
Processing End = 2004/08/02 16:03:19.973
Duration = 0000/00/00 00:00:04.125
KiXGolf Score = 367
Thank you for participating in KiXtart Golf!
press any key to close