IMPORTANT: RULE CLARIFICATION AND TEST ALIASI'd like to clarify a few of the rules and also use this opportunity to give you a test alias:
alias test_palicount {
var %+ = scon 1 $(%test = %test, 0), %i = 1, %test, %time, %tot, %fail
%+ jaytea 0
%+ a 0
%+ aa 0
%+ aaA 0
%+ 000 1
%+ 0x00 1
%+ 0x000 2
%+ abcc 0
%+ abcdcb 2
%+ racecarac 5
%+ aaaaa 6
%+ aaAaa 2
%+ aaAAAaa 3
%+ babbab 4
%+ babbabbab 10
%+ madamadam 8
%+ madammadam 8
%+ madamracecar 5
%+ donaldtrump 0
%+ amanaplanacanalpanama 16
%+ 00000000000000000000000000000000000000000000000000 1176
%+ 01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101 2352
%+ aAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaA 2352
%+ 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 4753
%+ aaasdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsdfbbb 2
%+ qlgapbhfcdyjkygrodepkwypocggteqvxpjgajvbcuvkltflpjbsmbwirysgqejsgtverbapiqvvjyolzyvsbwgqcsjxrpqccno 0
echo 3 -eag Starting test:
%time = $ticks
while ($gettok(%test, %i, 32) != $null) {
var %in = $v1, %out = $gettok(%test, $calc(1 + %i), 32)
if ($palicount(%in) != %out) {
echo 4 -ag Failed on $!palicount( $+ %in $+ ) (returned $v1 instead of %out $+ )
inc %fail
}
inc %tot
inc %i 2
}
%time = $calc($ticks - %time)
echo $iif(%fail, 4 -eag Failed. Only passed, 3 -eag Success! Passed) $calc(%tot - %fail) out of %tot tests in %time $+ ms
}
Just load and use
/test_palicount to test out your alias
Now, rules.. some of you have made some good points and raised interesting questions so I'll attempt to clarify them all here:
1. Code will be tested on mIRC
7.52 (thanks Ouims :P)
2. COM: let us now say COM is now
entirely disallowed. The rule in my post comes from a time when various scripters were learning and playing around with COM objects, and so I wanted to grant them the freedom to pursue methods that were almost certainly not going to be conducive to winning.
3. {} Braces: please include the final trailing brace. It's only 1 byte, everyone knows the trick by now, and I'll be adding it to your code if you omit it :P
4. Identifier warning will be
disabled. Go nuts :P
I think that's it, but stay tuned to this topic in case there are any further updates. Have fun!