mIRC Home    About    Download    Register    News    Help

Print Thread
Challenge(Short-Code): $alphanumeric #259247 22/10/16 08:40 AM
Joined: Apr 2010
Posts: 966
F
FroggieDaFrog Offline OP
Hoopy frood
OP Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 966
Overview
Starts: Saturday, October 22, 2016
Ends: Monday, October 31th, 2016 @ 12:00pm(noon) EST
Difficulty: Intermidiate
Type: Short-Code

Create an alias that returns a string containing all English alphanumeric characters:
- Lower-case English letters (a-z)
- Uppercase English letters (A-Z)
- Integers from 0 to 9 (0-9)

Examples
Code:
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
RWODA6zHQ2TdvYslewyg0FSaiIjbJhp1k95VquMKLtmfEGCx3rUnoXP47Z8cNB





Rules
  • Alias must be named alphanumeric
  • Only the characters a-z, A-Z and 0-9 are permitted to be in the returned string
  • White space with in the returned string is NOT permitted
  • Duplicate characters are NOT permitted
  • Order does not matter
  • No mismatched brackets`{}` or parentheses`()`
  • No literal strings
  • No enviornment dependancies such as $os, $dbuh, $dbuw, etc
  • mIRC congifuration dependancies are allowed such as $cid, $comchar, $modespl. Assume the value for a freshly installed never connected mIRC instance
  • Entries can contain supporting aliases
  • Entries do not have to run clean but must be able to re-run indefinitely.
  • Entries must not require user inputs such as from dialogs, entering a command, $?, $input, etc
  • No File-system access, COMs, DLLs, or Sockets
  • Do not abuse rules, test alias, or given external resources





Literal Strings
Any expression/input/text that isn't a command and doesn't evaluate into something else is a literal string.
- Space(ascii character 32) is considered a literal string when used as a character instead of an mSL seperator
- Mathmatical and conditional operators are considered a literal string when used as character(s) instead of their operator functionality
- Escaped identifiers via $! are considered literal strings: $!abcd

Identifiers that evaluate to themselves are considered literal strings: $true, $false, $yes, $no, $ok, $cancel, $~, etc
Identifiers that are simply character aliases are considered literal strings: $cr, $lf, etc
Ignore these two rules; they are allowed.



Valid Examples:
Code:
/thing1 $thing2 $thing3
if ($thing1 == $thing2)
if (%thingA)
$calc($thing1 + $thing2)


Invalid Examples:
Code:
$thingA(abc)               - Uses the literal string 'abc'
$thingA($thing1 $thing2)   - Uses a literal space
$thingA($thing1 + $thing2) - Operator used as a literal string





Submitting And Ranking
- Entry are to be submitted via Forum Privage Message with the topic "$alphanumeric Challenge - Entry"*
- You may submit as many times as you like, only your latest valid entry will be ranked at the end of the challenge.
- Valid Entries are ranked from shortest to longest where shorter is better
- Length will be calculated using the 'bytes' result from HERE
- I will check the forums at least once a day for new entries, evaluate them and respond to submitters if their entry is valid or not.

*: You may submit entries over IRC private messages but I cannot guarantee I will receive it.




Testing
Entries will be saved as alphanumeric.mrc
Entries will be loaded into a fresh disconnected portable mIRC v7.46 instance's REMOTE section.
Entries are loaded after the test alias's script file

The testing aliases do NOT check for string literals; this is done manually.
- Any entries that make use of a string literals that get passed the manual check are considered valid for the challenge. I will not fault participants for my mistakes

Code:
;; /test_alphanumeric @Times
;;     Tests the challenge alias $alphanumeric
;;
;;     @Times - optional
;;         The number of times to test the alias for failure
;;         If not specified, defaults to 10
alias test_alphanumeric {
  if ($isid) {
    return
  }
  if ($_test_alphanumeric($iif($0, $1, 10))) {
    echo 04 -a Failed $v1
  }
  else {
    echo 03 -a All tests passed! Example Result: $alphanumeric
  }
}
alias -l _test_alphanumeric {
  var %x = 0, %result
  while (%x < $1) {
      inc %x
      %result = $alphanumeric

      if (!$len(%result)) {
        return $ord(%x) iteration: Nothing returned
      }
      elseif ($regex(%result, /([^a-zA-Z0-9])/)) {
        return $ord(%x) iteration: Returned non-alpha-numeric character: $regml(1)
      }
      elseif ($regex(%result, /(.).*?\1/)) {
        return $ord(%x) iteration: Duplicate character: $regml(1)
      }
      elseif ($regsubex(abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789, /[ $+ %result $+ ]/g,) || $v1 === 0) {
        return $ord(%x) iteration: Missing character(s): $v1
      }
  }
}





Personal Entry:
For the sake of being able to compete while running the challenge I am allowing myself to update my entry until the first valid entry is submitted by someone else. At which point my own entry will be considered finalized.

1297fdce56d8494d857a0cc079fd1d5593c99524 - Not Finalized
- $sha1() of my entry's alphanumeric.mrc file
- contains an unintended trailing line break that mIRC injects, which is not counted in my final byte count

Last edited by FroggieDaFrog; 22/10/16 12:43 PM.

I am SReject
My Stuff
Re: Challenge(Short-Code): $alphanumeric [Re: FroggieDaFrog] #259249 22/10/16 06:30 PM
Joined: Apr 2010
Posts: 966
F
FroggieDaFrog Offline OP
Hoopy frood
OP Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 966
I can no longer edit the original post. My current entry:

cdf29927ea2e65f7d8870d4d77a588451a87f2d0
- $sha1() of my entry's alphanumeric.mrc file
- contains an unintended trailing line break that mIRC injects, which is not counted in my final byte count.


--
Instead of spamming the post with updates. Jay2k1 on quakenet's #help.script has been given a copy of my entry for verification

Last edited by FroggieDaFrog; 22/10/16 06:40 PM.

I am SReject
My Stuff