Please see the below replies for extra clarification and important updates to the rules!

I would like to share an old tradition with you, one that inspired myself and many of my fellow scripters over the years to cultivate our knowledge of mIRC's fun and quirky syntax. It's a tradition that bred generations of avid scripters, sparked valuable discussion, and provided many hours of satisfying thought to all those who partook.

I'm talking, of course, about mIRCscripting challenges.

I have one for you. It's easily stated, maybe even easily coded, but I hope and estimate it will be tricky to fashion a winning entry.

Name: $palicount() - a palindrome counter!
Difficulty: Easy
Criteria: Shortcode
Deadline: Wed 21 Nov 10:00 (10am) GMT

Description:

Your challenge is to create a custom identifier that returns the total number of palindromes in the input. This includes palindromes that are part of other, larger palindromes. Ignore palindromes less than 3 characters in length.

Examples:

$palicount(abcc) = 0

$palicount(abcdcb) = 2
The palindromes here are "bcdcb" and "cdc".

$palicount(racecarac) = 5
The palindromes here are "racecar", "aceca", "cec", "carac", and "ara".

$palicount(aaaaa) = 6
The palindromes here are "aaaaa", two occurrences in different positions of "aaaa", and three of "aaa".

$palicount(babbab) = 4
The palindromes here are "babbab", "bab", "bab", and "abba".

Input:

The input will be a single argument consisting of an alphanumeric string less than 100 characters.

Output:

A single integer N representing the number of palindromes found.

Judging:

Your alias will be judged based on its codesize as measured by the following link: https://jay-tea.github.io/mirc/countcode.html

Regex related functions in mIRC have come a long way over the years, and now provide scripters with a set of tools so powerful that it is no longer fair to allow them to compete with other methods.

So, there will be two winning categories: regex and non-regex. One scripter may compete in both of these categories with separate entries if they wish.

Rules:

- Your alias should be case sensitive, ie. $palicount(abA) = 0
- Your code will be loaded into the remote section of a clean mIRC instance.
- Additional code, such as an auxiliary remote alias, is allowed.
- No sockets.
- COM Object are permitted, but no calls that involve network communication.
- Your alias must run "cleanly", ie. not leave behind any hash tables, global variables, @windows, etc.
- Your alias must be able to run consecutively and return correct values if called more than once in the same line of code.
- This is not a lateral thinking exercise. I won't accept any exploitation of the rules or countcode script, no matter how creative.
- Similarly, your alias needs to terminate before I die.

Submitting:

Entries should be submitted to me through PM on these forums, or on IRC if you don't have an account.

Test alias:

To be made! Check back later.

By the way, I would be interested and greatly amused to see an entry from you, Khaled, if you happen to be reading this laugh

Last edited by Khaled; 23/10/18 09:27 AM.

"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde