mIRC Home    About    Download    Register    News    Help

Topic Options
#259015 - 27/09/16 12:56 AM Challenge(Short-Code): $numbers
FroggieDaFrog Online
Hoopy frood

Registered: 16/04/10
Posts: 907
Loc: USA
Overview
Starts: Monday, September 26, 2016
Ends: Monday, October 10th, 2016 @ 12:00pm(noon) ET
Description: Return all the numbers between 0 through 9 without using numbers in your code
Type: Short-Code

Explanation:
  • Create an alias that returns all the numbers from 0 through 9 without using any numbers in your code
  • Duplicate numbers within the returned value are not allowed
  • Non-numerical characters in the returned value are not allowed
  • Order does not matter
  • Alias must be named numbers
  • There are two categories: Entries that make use of Re-Encode/decoding inputs and those that do not


Categories:
There are two categories for this challenge of which can be entered. You may submit to either or both categories. That is you may submit an entry for one of the catagories and make another submission for the other. The categories are:
  • Re-Encoding/Decoding via $chr(), $asc(), or similar; Entries in this category make use of a static string that isn't produced from native mIRC functionality to derive the resulting numbers from
  • Non Re-Encoding/Decoding: Entries in this category pull all numbers/inputs from the result of native mIRC functionality alone


Rules:
  • Your code's length will be calculated using the 'byte' value from HERE
  • Your code will be saved as numbers.mrc
  • Your code will be loaded into a fresh mIRC v7.46 instance's remote section
  • Your code can contain supporting aliases
  • Your code does not have to run clean but it must be able to re-run indefinitely.
  • No use of external-input identifiers such as $?, $input, etc
  • No File-system access
  • No Coms
  • No DLLs
  • No Sockets
  • Do not abuse the rules, byte counter or test alias


Submitting:
  • Send entries to me via Forum Privage Message with the topic "$Numbers Challenge - Entry"
  • In your entry post, specify if it uses Re-Encoding/Decoding to achieve the goal or not
  • You may submit as many times as you like, only your last entry for each category at the end of the challenge will be evaluated
  • I will check the forums at least once a day for new entries, evaluate them and tell you if the entry is valid


Test Alias:
Code:
;; /test_numbers @N
;; @N = Number of times to test the $numbers alias
alias test_numbers {
  if ($_test_numbers($iif($1,$1,10))) {
    echo 04 -a Failed $v1
  }
  else {
    echo 03 -a All tests passed!
  }
}
alias -l _test_numbers {
  if ($read($scriptdirnumbers.mrc, r, /(\d)/, 1)) {
    return 0 File contains a number on line: $readn
  }
  else {
    var %x = 0, %e = $1, %numbers
    while (%x < %e) {
      inc %x
      %Numbers = $numbers
      if (!$len(%Numbers)) {
        return $ord(%x) pass: Nothing returned
      }
      elseif ($regex(%Numbers, /([^\d])/)) {
        return $ord(%x) pass: Contains non-numerical character $regml(1)
      }
      elseif ($regex(%numbers, /(.).*?\1/)) {
        return $ord(%x) pass: Contains duplicate $regml(1)
      }
      elseif ($regsubex(0123456789, /[ $+ %numbers $+ ]/g,)) {
        return $ord(%x) pass: Missing $v1
      }
    }
  }
}





My ReEncode/Decode Entry sha256: 4509a16b85eb15bc5ecea144eda6550aa589e9e75fa33a589fa582e25b8fc870
I have no entry for non-ReEncode/Decode


Edited by FroggieDaFrog (27/09/16 05:52 AM)
_________________________
I am SReject
My Stuff

Top
#259018 - 27/09/16 04:21 PM Re: Challenge(Short-Code): $numbers [Re: FroggieDaFrog]
Sat Offline
Hoopy frood

Registered: 19/04/04
Posts: 831
Loc: The Netherlands
Fun! It's been a while.

Is my following interpretation of the rules for "Non Re-Encoding/Decoding" correct?..

- while $asc($) is disallowed (a literal "$"), $asc($true) is allowed (as $true is built-in)

- given a built-in string function $builtin1(): while $builtin1($builtin2 $+ $builtin3) is allowed, $builtin1($builtin2 $builtin3) is not, because it would be using a literal space as part of the input

Thanks!
_________________________
Saturn, QuakeNet staff

Top
#259019 - 27/09/16 06:44 PM Re: Challenge(Short-Code): $numbers [Re: Sat]
FroggieDaFrog Online
Hoopy frood

Registered: 16/04/10
Posts: 907
Loc: USA
For the non encode/decode category

Originally Posted By: Sat
while $asc($) is disallowed (a literal "$"), $asc($true) is allowed (as $true is built-in)

Correct. For this category, you may not use literal strings with a few exceptions mentioned below.

Originally Posted By: Sat
given a built-in string function $builtin1(): while $builtin1($builtin2 $+ $builtin3) is allowed, $builtin1($builtin2 $builtin3) is not, because it would be using a literal space as part of the input
A literal space is an exception becuase it MUST be sandwiched between non space values for the space to have any impact on code evaluation. Though not directly returned by a built in identifier it requires the use of other identifers to alter the processing.

The other (known) exception to literal string usage is the pattern portion of reg/sub/ex calls. This exception is made because a reg/sub/ex pattern does not, in any direct way, become part of the returned result; instead the pattern is more of a directive than a literal. The other rules(no numbers) still apply to the pattern though.


Edited by FroggieDaFrog (27/09/16 10:30 PM)
_________________________
I am SReject
My Stuff

Top
#259021 - 27/09/16 08:45 PM Re: Challenge(Short-Code): $numbers [Re: FroggieDaFrog]
westor Offline
Hoopy frood

Registered: 27/12/08
Posts: 1511
Loc: Greece
That's really good challange!! Good idea SReject!
_________________________
Need Online mIRC help or an mIRC Scripting Freelancer? -> http://westor.ucoz.com/contact <-

Top
#259026 - 28/09/16 03:28 AM Re: Challenge(Short-Code): $numbers [Re: FroggieDaFrog]
FroggieDaFrog Online
Hoopy frood

Registered: 16/04/10
Posts: 907
Loc: USA
NOTICE

Would those that enter prefer I stick with the originally stated byte counter or would you prefer if I used My Own(src).

The reason I ask is the current byte counter does not account for mSL as a language(or any coding language for that matter) where as mine does. To be clear, if there's any dispute I will not switch to the new counter


Edited by FroggieDaFrog (28/09/16 03:37 AM)
_________________________
I am SReject
My Stuff

Top
#259033 - 28/09/16 06:35 PM Re: Challenge(Short-Code): $numbers [Re: FroggieDaFrog]
FroggieDaFrog Online
Hoopy frood

Registered: 16/04/10
Posts: 907
Loc: USA
TEST ALIAS UPDATE

There is a bug in the test alias from the original post, the following fixes that bug and will be used to test entries:
Code:
alias test_numbers {
  if ($_test_numbers($iif($1,$1,10))) {
    echo 04 -a Failed $v1
  }
  else {
    echo 03 -a All tests passed! Example Result: $numbers
  }
}
alias -l _test_numbers {
  if ($read($scriptdirnumbers.mrc, r, /(\d)/, 1)) {
    return File contains a number on line: $readn
  }
  else {
    var %x = 0, %e = $1, %numbers
    while (%x < %e) {
      inc %x
      %Numbers = $numbers
      if (!$len(%Numbers)) {
        return $ord(%x) loop: Nothing returned
      }
      elseif ($regex(%Numbers, /([^\d])/)) {
        return $ord(%x) loop: Returned non-numerical character $regml(1)
      }
      elseif ($regex(%numbers, /(.).*?\1/)) {
        return $ord(%x) loop: Contains a duplicate $regml(1)
      }
      elseif ($regsubex(1234567890, /[ $+ %numbers $+ ]/g,) || $v1 === 0) {
        return $ord(%x) loop: Missing $v1
      }
    }
  }
}


Edited by FroggieDaFrog (28/09/16 06:36 PM)
_________________________
I am SReject
My Stuff

Top
#259047 - 29/09/16 06:27 PM Re: Challenge(Short-Code): $numbers [Re: FroggieDaFrog]
Dazuz Offline
Vogon poet

Registered: 01/12/15
Posts: 113
Loc: Finland
I'd personally go with the real size, but I'm fine with both.

Top
#259069 - 01/10/16 01:36 PM Re: Challenge(Short-Code): $numbers [Re: FroggieDaFrog]
Talon Offline
Vogon poet

Registered: 09/12/02
Posts: 192
Loc: Ohio, USA
are mathematical operations part of the exempt list like a regular expression or a space? specifically =, +, -, *, /, ^ and % ? (equals, add, subtract, multiply, divide, power, modulus)

say: var %a = %b + %c

This is native mIRC functionality.

Also: what about regsubex with the use of markers, obviously \0 is out of the question because it contains a digit, but does the replacement part also fall into the realm of the exempt list or just the expression itself?

Top
#259072 - 01/10/16 05:25 PM Re: Challenge(Short-Code): $numbers [Re: Talon]
FroggieDaFrog Online
Hoopy frood

Registered: 16/04/10
Posts: 907
Loc: USA
For the Non-Encode Catagory

Originally Posted By: Talon
are mathematical operations part of the exempt list like a regular expression or a space? specifically =, +, -, *, /, ^ and % ? (equals, add, subtract, multiply, divide, power, modulus)

say: var %a = %b + %c

For the non-encode catagory, mathematical operators ARE fine to use IF they are used for operation purposes:
Code:
;; this is fine:
$calc($NativeThing + $NativeThing2)

;;This isn't fine:
$NativeThing(=+=)



Originally Posted By: Talon
Also: what about regsubex with the use of markers, obviously \0 is out of the question because it contains a digit, but does the replacement part also fall into the realm of the exempt list or just the expression itself?
Only the PATTERN portion of a reg/sub/ex is exempt. The replacement text and markers are NOT exempt and must come from a native source


Edited by FroggieDaFrog (01/10/16 05:26 PM)
_________________________
I am SReject
My Stuff

Top
#259081 - 02/10/16 01:32 AM Re: Challenge(Short-Code): $numbers [Re: FroggieDaFrog]
pball Online
Fjord artisan

Registered: 04/11/09
Posts: 294
Do identifiers with numbers in their name break the no numbers in the code rule?

For example using $ansi2mirc or $atan2 to return a value.
_________________________
http://scripting.pball.x10.mx/
My personal site with some scripts I've released.

Top
#259082 - 02/10/16 01:48 AM Re: Challenge(Short-Code): $numbers [Re: pball]
FroggieDaFrog Online
Hoopy frood

Registered: 16/04/10
Posts: 907
Loc: USA
Numbers are NOT allowed anywhere within an entry. The test alias literally checks the file(numbers.mrc) for a number before it even attempts to run the alias


Edited by FroggieDaFrog (02/10/16 01:49 AM)
_________________________
I am SReject
My Stuff

Top
#259158 - 10/10/16 10:21 PM Re: Challenge(Short-Code): $numbers [Re: FroggieDaFrog]
FroggieDaFrog Online
Hoopy frood

Registered: 16/04/10
Posts: 907
Loc: USA
RESULTS

So after two weeks of tinkering there is a winner

...
...
...

Saturn for both categories!!

Pastebin of all Entries




Encode/Decode Results

1. Saturn - Quakenet - 36 bytes
- The $hmac contains \x2F\x03\x14
Code:
alias numbers return $or($hmac(/))


2. Spling - SwiftIRC - 43 bytes
- First $asc contains: \u3490
- Second $asc contains: \u5135
Code:
alias numbers return $asc(&#13456;) $+ $asc(&#20789;)


2. pball - Forums - 43 bytes
- First $asc contains: \u4F79
- Second $asc contains: \u4195
Code:
alias numbers return $asc(&#20345;) $+ $asc(&#16789;)


2. Wims - SwiftIRC - 43 bytes
- First $asc contains: \u3034
- Second $asc contains: \uDDD5
- - The character is a unicode lower surrogate and requires some fanagling
Code:
alias numbers return $asc(&#12340;) $+ $asc(&#545833;)


5. NiLon - QuakeNet - 45 bytes
Code:
alias numbers return $decode(*.#`R-#$U-SDS-@)


6. Dazuz - Forums - 48 bytes
Code:
alias numbers return $decode(OTgzNzYyNTQxMA==,m)


7. FroggieDaFrog - 51 bytes
- First $asc contains: \u04D2
- Second $asc contains: \u0237
- Third $asc contains: \u037A
Code:
alias numbers return $+($asc(&#1234;),$asc(&#567;),$asc(&#890;))


8. bindi - Quakenet - 53 bytes
Code:
alias numbers return $base(NHOKIA,$asc(##),$asc($lf))


9. Westor - SwiftIRC - 139 bytes
Code:
alias numbers return $+($len(),$cos(q),$len(we),$len(wes),$len(west),$len(westo),$len(westor),$len(westor!),$len(westor!@),$len(westor!@#))



Non Encode/Decode Results

1. Saturn - QuakeNet - 48 bytes
Code:
alias numbers return $hash($~ $remote $cr,$bits)


2. Wims - SwiftIRC - 71 bytes
Code:
alias numbers return $regsubex($readn $pi,/(?<a>\d)(?=.*\k<a>)|[. ]/g,)


3. Dazuz - forums - 74 bytes
Code:
alias numbers while ($len(%r) < $asc($lf)) %r = %r $+ $ifmatch | return %r


4. NiLon - QuakeNet - 75 bytes
Code:
alias numbers return $regsubex($hmac($cid),/\D+|(\d)(?=.*?\ $+ $cid )/gx,)


5. pball - forums - 92 bytes
Code:
alias numbers { while ($len(%x) < $len(a) $+ $len()) { var %x %x $+ $len(%x) } | return %x }




Edited by FroggieDaFrog (10/10/16 10:37 PM)
_________________________
I am SReject
My Stuff

Top
#259159 - 10/10/16 10:42 PM Re: Challenge(Short-Code): $numbers [Re: FroggieDaFrog]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3438
Loc: France
Very impressive Saturn!
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#259160 - 10/10/16 10:45 PM Re: Challenge(Short-Code): $numbers [Re: FroggieDaFrog]
Sat Offline
Hoopy frood

Registered: 19/04/04
Posts: 831
Loc: The Netherlands
Yay!

SReject, thanks so much for organizing and managing this!
_________________________
Saturn, QuakeNet staff

Top
#259161 - 10/10/16 10:58 PM Re: Challenge(Short-Code): $numbers [Re: Sat]
FroggieDaFrog Online
Hoopy frood

Registered: 16/04/10
Posts: 907
Loc: USA
Originally Posted By: Sat
SReject, thanks so much for organizing and managing this!

It was no problem and very much over-due. I probably enjoyed watching everyone advance their submissions over the duration more than you all did making your entries. (So much hair pulling I imagine)

Furthering this, I hope to have a new challenge posted this Friday, that again will run for two weeks. The challenge will build upon the ideas and concepts laid on in this challenge but still be unique in its own way.

Sidebar: If anyone has ideas for future challenges, don't be afraid to contact me. We can talk about the idea, hash out the details and I'll have no issue running/managing it!
_________________________
I am SReject
My Stuff

Top
#259162 - 10/10/16 11:10 PM Re: Challenge(Short-Code): $numbers [Re: FroggieDaFrog]
spling Offline
Ameglian cow

Registered: 26/10/03
Posts: 34
Loc: Canada
That was fun. Congrats Saturn!

But.. I think Westor is the real winner here!

Top
#259166 - 11/10/16 06:48 PM Re: Challenge(Short-Code): $numbers [Re: spling]
westor Offline
Hoopy frood

Registered: 27/12/08
Posts: 1511
Loc: Greece
ahhaha LOL! very clever method!!! good job guys!
_________________________
Need Online mIRC help or an mIRC Scripting Freelancer? -> http://westor.ucoz.com/contact <-

Top
#264040 - 22/10/18 07:36 AM Re: Challenge(Short-Code): $numbers [Re: FroggieDaFrog]
maroon Offline
Hoopy frood

Registered: 12/01/04
Posts: 970
Because of the new Challenge, I went back to look at the older Challenges. I'm sure I would not have done better if I'd been here then, but with Saturn pointing the way, I played around with his method. Most of the other solutions I found were longer, but I did find one slightly shorter.

Since the rules say it's for a fresh install, the default for $sreq and $creq is 'ask'. And if $~ is allowed, then I would assume that $$ is also allowed. This shaves the non-encoding variant by 2 bytes to 46.

Code:
alias numbers return $hash($sreq $$ $cr,$bits)

Top