; 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