#191144 - 2008-12-14 03:05 PM
Re: KiXgolf - Easier Done Than Said - Public Round
[Re: RemcovC]
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
LOL! well I gave it a try
|
Top
|
|
|
|
#191145 - 2008-12-14 03:11 PM
Re: KiXgolf - Easier Done Than Said - Public Round
[Re: Sealeopard]
|
DrillSergeant
MM club member
Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
|
|
Top
|
|
|
|
#191232 - 2008-12-16 10:40 PM
Re: KiXgolf - Easier Done Than Said - Public Round
[Re: Jochen]
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
|
Top
|
|
|
|
#191253 - 2008-12-17 08:40 AM
Re: KiXgolf - Easier Done Than Said - Public Round
[Re: Lonkero]
|
RemcovC
Starting to like KiXtart
Registered: 2006-09-13
Posts: 174
Loc: Holland
|
First I'm not posting this to get first place in this round, I don't even want this code to be taken in cosideration as serious code. The reason I post this is because I think the rules are not full proof, and should be adjusted slightly. I think there should be a rule like this:
- Code posted in the public round (also the code to validate the private round) should be conform stated rules in the assignment. The test cases provided in the package are a tool to help you achieve this goal but are not final.
This will exclude code like in the previous posts, and code like this. And please don't go golfing this code, I only posted it to make a statement.
Again just to make myself clear I don't want this code to count in the tournament. I really feel like this is cheating in the worst way possible.
KiXtart Golf Score
Tournament = Easier Done Than Said?
Processing Start = 2008/12/17 08:37:12.598
Processing End = 2008/12/17 08:37:12.623
Duration = 0000/00/00 00:00:00.024
KiXGolf Score = 108
Function EDTS($)
$EDTS = '<' + $ + '> is ' + IIf((instr(aeh,Left($,1))&left($,2))<>ab,a,'not a') + cceptable.
EndFunction
_________________________
It's better to have scripted and died, then to never have scripted at all
|
Top
|
|
|
|
#191259 - 2008-12-17 12:46 PM
Re: KiXgolf - Easier Done Than Said - Public Round
[Re: Lonkero]
|
BradV
Seasoned Scripter
Registered: 2006-08-16
Posts: 686
Loc: Maryland, USA
|
I couldn't figure out how to get my code into the scoring engine. I shoved it into the UDF where I was told, but got an immediate illegal (or undeclared?) $p. I then put in code to read the test ini file. That wound up running it 12*12 times. After looking at everyone else's code, I can see where I messed up. I'll try to fix it this evening and see how bad I was.
|
Top
|
|
|
|
#191302 - 2008-12-18 01:02 PM
Re: KiXgolf - Easier Done Than Said - Public Round
[Re: Sealeopard]
|
BradV
Seasoned Scripter
Registered: 2006-08-16
Posts: 686
Loc: Maryland, USA
|
No, my problem was I wrote a separate piece of code that took input from the keyboard. Then, when I found out I was supposed to put it in the udf file, I couldn't figure out how I was supposed to get the password. I last attempt was opening the ini file and reiterating through it. That didn't work. When the public round started, I saw that I just needed to accept it as input to my function.
|
Top
|
|
|
|
#191314 - 2008-12-18 10:44 PM
Re: KiXgolf - Easier Done Than Said - Public Round
[Re: BradV]
|
BradV
Seasoned Scripter
Registered: 2006-08-16
Posts: 686
Loc: Maryland, USA
|
I'm missing something. When I run my code by itself and manually input passwords, it works as expected. When I put it in the UDF, the output looks fine to me, but it says I've failed all 12 tests. What am I missing?
Score here:
KiXtart
KiXtart Version = 4.52
KiXGolf Script = kixgolf_edts.kix
Computer
OS = Windows XP Media Center Edition
CPU = Intel(R) Pentium(R) 4 CPU 3.00GHz
Speed = 3000 MHz
Memory = 1016 MB
KiXGolf Scoring Engine
Scoring Engine = 3.3
KiXtart Golf Score
Tournament = Easier Done Than Said?
Processing Start = 2008/12/18 16:29:53.905
Processing End = 2008/12/18 16:29:53.921
Duration = 0000/00/00 00:00:00.016
KiXGolf Score = 489
Thank you for participating in KiXtart Golf!
; begin KiXgolfUDF
;
;!
Function EDTS($p)
dim $l,$u,$o,$c,$t,$k,$a,$i,$n,$b
;gets $p
;$p = input password
;$l = length of input password
;$u = previous character
;$c = current character
;$t = character type (of last character), vowel, consonants, or other (v,c,o)
;$k = boolean if password is OK. Assume true to start.
;$a = boolean if found at least one vowel. Assume false to start.
;$o = count of consecutive vowels
;$b = count of consecutive consonants
;$i = loop iteration variable
;$n = "not" variable
$l=len($p)
$u=""
$o=0
$b=0
$t=""
$k=1
$a=0
for $i = 1 to $l ; iterate through all characters
$c=substr($p,$i,1) ; pick the ith character
if instr("aeiou",$c) ; is the character a vowel?
$b = 0 ; since this is a vowel, consecutive consonants is now 0
$a=1 ; found a vowel. set $a true
if $c = $u ; is this character the same as the last character?
if not ($o = 0 and instr("eo",$c)) ; only allow "ee" and "oo"
$k = 0 ; it's not. So, fail the word
endif
endif
if $t = "v" ; was the last character a vowel?
if $o = 0 ; is the consecutive vowel count 0?
$o = 1 ; if so, increment it
else
if $o > 0 ; had too many consecutive vowels
$k = 0 ; fail this password
$o = 5 ; set consecutive vowel count to some large number
endif
endif
else
$o = 0 ; last character was not a vowel. Set consecutive vowel count to 0
endif
$t = "v" ; set last character to a vowel (this character for next loop)
else
if instr("bcdfghjklmnpqrstvwxyz",$c) ; not a vowel, is it a consonant?
$o = 0 ; is a consonant. Therefore the consecutive vowel count is 0
if $c = $u ; is this character the same as the last character?
$k = 0 ; if so, fail this password
endif
if $t = "c" ; was the last character a consonant?
if $b = 0 ; is the consecutive consonant count 0?
$b = 1 ; if so, increment it
else
if $b > 0 ; had too many consecutive consonants
$k = 0 ; fail the password
$b = 5 ; set consecutive consonant count to some large number
endif
endif
else
$b = 0 ; last character was not a consonant. Set the consecutive consonant count to 0
endif
$t = "c" ; set last character to a consonant (this character for next loop)
else
$k=0 ; found a character other than a letter. Fail this password
$t = "" ; set the last type to other
endif
endif
$u = $c ; make the next last character this character
next
if $a = 1 and $k = 1 ; if we found a vowel and did not change OK to false
$n = "" ; ok
else
$n = " not" ; failed
endif
? "<" + $p + "> is" + $n +" acceptable."
endFunction
;!
; end KiXgolfUDF
Obviously not golfed, but not sure why it tells me I failed.
Regards,
Brad
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 530 anonymous users online.
|
|
|