mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Apr 2010
Posts: 969
F
Hoopy frood
OP Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
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

Last edited by FroggieDaFrog; 27/09/16 04:52 AM.

I am SReject
My Stuff
Joined: Apr 2004
Posts: 871
Sat Offline
Hoopy frood
Offline
Hoopy frood
Joined: Apr 2004
Posts: 871
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
Joined: Apr 2010
Posts: 969
F
Hoopy frood
OP Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
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.

Last edited by FroggieDaFrog; 27/09/16 09:30 PM.

I am SReject
My Stuff
Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
That's really good challange!! Good idea SReject!


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Joined: Apr 2010
Posts: 969
F
Hoopy frood
OP Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
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

Last edited by FroggieDaFrog; 28/09/16 02:37 AM.

I am SReject
My Stuff
Joined: Apr 2010
Posts: 969
F
Hoopy frood
OP Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
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
      }
    }
  }
}

Last edited by FroggieDaFrog; 28/09/16 05:36 PM.

I am SReject
My Stuff
Joined: Dec 2015
Posts: 148
Vogon poet
Offline
Vogon poet
Joined: Dec 2015
Posts: 148
I'd personally go with the real size, but I'm fine with both.

Joined: Dec 2002
Posts: 252
T
Fjord artisan
Offline
Fjord artisan
T
Joined: Dec 2002
Posts: 252
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?

Joined: Apr 2010
Posts: 969
F
Hoopy frood
OP Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
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

Last edited by FroggieDaFrog; 01/10/16 04:26 PM.

I am SReject
My Stuff
Joined: Nov 2009
Posts: 295
P
Fjord artisan
Offline
Fjord artisan
P
Joined: Nov 2009
Posts: 295
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.win
My personal site with some scripts I've released.
Joined: Apr 2010
Posts: 969
F
Hoopy frood
OP Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
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

Last edited by FroggieDaFrog; 02/10/16 12:49 AM.

I am SReject
My Stuff
Joined: Apr 2010
Posts: 969
F
Hoopy frood
OP Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
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 }



Last edited by FroggieDaFrog; 10/10/16 09:37 PM.

I am SReject
My Stuff
Joined: Jul 2006
Posts: 4,141
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,141
Very impressive Saturn!


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Apr 2004
Posts: 871
Sat Offline
Hoopy frood
Offline
Hoopy frood
Joined: Apr 2004
Posts: 871
Yay!

SReject, thanks so much for organizing and managing this!


Saturn, QuakeNet staff
Joined: Apr 2010
Posts: 969
F
Hoopy frood
OP Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
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
Joined: Oct 2003
Posts: 34
S
Ameglian cow
Offline
Ameglian cow
S
Joined: Oct 2003
Posts: 34
That was fun. Congrats Saturn!

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

Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
ahhaha LOL! very clever method!!! good job guys!


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
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)


Link Copied to Clipboard