Page 3 of 3 <123
Topic Options
#124288 - 2004-08-04 04:22 PM Re: KiXgolf: Vigenere Cipher - Public coding
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
What! and suffer a 2 stroke penalty? This is golf, not best practices!
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#124289 - 2004-08-04 04:24 PM Re: KiXgolf: Vigenere Cipher - Public coding
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
I see it works, but how come??

What's so special about the !-character it doesn't need quotes?
_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#124290 - 2004-08-04 04:28 PM Re: KiXgolf: Vigenere Cipher - Public coding
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
That's just it. It is nothing special. It is the forgiving nature of KiX.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#124291 - 2004-08-04 04:31 PM Re: KiXgolf: Vigenere Cipher - Public coding
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
363???

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 = Right($k,-1)+$
$y = InSTR($p,$)
Until $y
$ = SubSTR($t,$j,1)

;Lonk $o=$o+($=" ") -$o*($=!|$='?'|$='.')
;Modified $o=IIf($=!|$='?'|$='.',0,$o+($=" "))

$r = InSTR($p,$)
If $r
$ = 62 - (UCase($t+$k)=$t+$k)*26
$ = SubSTR($p,1+($+$r+(2*($d=0)-1)*($y-IIf($=!|$='?'|$='.',0,$o+($=" "))-2)-1) mod $,1)
EndIf
$vigenere = $vigenere + $
Next
EndFunction
;!
;!



Have to check word shift...
_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#124292 - 2004-08-04 04:34 PM Re: KiXgolf: Vigenere Cipher - Public coding
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
Quote:

That's just it. It is nothing special. It is the forgiving nature of KiX.




What does Ruud say about this? Bug???
_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#124293 - 2004-08-04 04:44 PM Re: KiXgolf: Vigenere Cipher - Public coding
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Feature!

We see ppl using strings without quotes all the time. If Ruud disabled that feature it would break lots of scripts.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#124294 - 2004-08-04 07:38 PM Re: KiXgolf: Vigenere Cipher - Public coding
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
Quote:

363???
||
||
Have to check word shift...




Wrong word shift. Actually I think all posted solutions are wrong!!!


Consider:
vigenere('AA AA','A') ?
vigenere('AA AA. AA AA','A') ?

With Lonk's latest code this gives:
CC DD
CC DD. DD EE

I think the second one should be CC DD. CC DD
This because after the second space the first word in the second sentence starts. Therefore the result should be the same as the first word in the first sentence, CC.

Comments please!
_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#124295 - 2004-08-04 07:49 PM Re: KiXgolf: Vigenere Cipher - Public coding
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
obviously your 363 will not work, as you don't have wording shift at all in there.

what comes to wordshift...
well, after word-separator, word count increases.
the ruling did not say how that happens, basically.
so, we can choice (I think)
specially, when the tourney is this far.
otherwise, there is no acceptable code in private at all.
_________________________
!

download KiXnet

Top
#124296 - 2004-08-04 08:20 PM Re: KiXgolf: Vigenere Cipher - Public coding
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
As I (&u) said 363 is no go. Agreed.

But the Question to Jens is are the others valid. And shouldn't the sentence seperators be '. ', '? ' or '! ' ?

_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#124297 - 2004-08-04 11:02 PM Re: KiXgolf: Vigenere Cipher - Public coding
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
391 with correct word shift.
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=Right($k,-1)+$
$y=InSTR($p,$)
Until $y

$=SubSTR($t,$j,1)
$r=InSTR($p,$)
$o=IIf(0<InSTR('! ? . ',$+SubSTR($t,$j+1,1)),-1,$o+($=' '))

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

_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#124298 - 2004-08-05 09:25 AM Re: KiXgolf: Vigenere Cipher - Public coding
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
wouldn't it then be (385):
$o=IIf(0<InSTR('! ? . ',SubSTR($t,$j,2)),0,$o+($=' '))
or even (382):
$o=$o+($=' ')-$o*(0<InSTR('! ? . ',SubSTR($t,$j,2))
_________________________
!

download KiXnet

Top
#124299 - 2004-08-05 02:31 PM Re: KiXgolf: Vigenere Cipher - Public coding
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
Nope, both wrong; both solutions give:

'AA AA', 'A' ==> CC DD
'AA AA. AA AA', 'A' ==> CC DD. DD EE



The code could be 387 and be correct if
Code:
$o=IIf(0<InSTR('! ? . ',SubSTR($t,$j,2)),-1,$o+($=' '))



this gives

'AA AA', 'A' ==> CC DD
'AA AA. AA AA', 'A' ==> CC DD. CC DD

Which in my opinion is correct.

_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#124300 - 2004-08-08 01:39 AM Re: KiXgolf: Vigenere Cipher - Public coding
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Yes, Patrick. This is correct. See also the encryption example in the rules. The offset restarts with each sentence.
_________________________
There are two types of vessels, submarines and targets.

Top
#124301 - 2004-08-08 02:20 PM Re: KiXgolf: Vigenere Cipher - Public coding
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
that is obvious.
all codes have that working.

what we are talking about now, should wordnumber be incremented if there is extra space in the input.
that never got any ruling.
_________________________
!

download KiXnet

Top
#124302 - 2004-08-08 02:30 PM Re: KiXgolf: Vigenere Cipher - Public coding
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
with new rulebase, going to lead anyways, 382:

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 = right($k,-1)+$
$y = instr($p,$)
until $y
$ = substr($t,$j,1)
$o = ($o+($=" "))*(0=instr('!?.',substr($t,$j-1,1)))
$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

_________________________
!

download KiXnet

Top
#124303 - 2004-08-09 12:36 AM Re: KiXgolf: Vigenere Cipher - Public coding
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
I was so close to victory...
_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#124304 - 2004-08-11 03:55 AM Re: KiXgolf: Vigenere Cipher - Public coding
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
It seems to me that for the first time, we do not have a winner of the private coding phase to to problems with the rule interpretation. However, the second round goes to code-magician Jooel who'd even squeeze orange juice out of freeze-drief oranges ;-)

I'll make sure that I will have a simpler task with more clear rules and examples for the next round. I'll also try to make sure to have more time to administer the next round. Unfortunately, I've had a couple of 12+ hour work-days during the last couple of days as a couple of financial statement release dates approached and I had to fulfill numerous data requests. Darn corporate world ;-)
_________________________
There are two types of vessels, submarines and targets.

Top
#124305 - 2004-08-13 11:25 PM Re: KiXgolf: Vigenere Cipher - Public coding
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
Happy to be part of the Golf club.

Jens, thanks for 'hosting' the game.
_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
Page 3 of 3 <123


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 1198 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.1 seconds in which 0.057 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org