|
Joined: Apr 2010
Posts: 969
Hoopy frood
|
OP
Hoopy frood
Joined: Apr 2010
Posts: 969 |
OverviewStarts: 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:;; /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.
|
|
|
|
Joined: Apr 2004
Posts: 871
Hoopy frood
|
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
Hoopy frood
|
OP
Hoopy frood
Joined: Apr 2010
Posts: 969 |
For the non encode/decode categorywhile $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. 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.
|
|
|
|
Joined: Dec 2008
Posts: 1,515
Hoopy frood
|
Hoopy frood
Joined: Dec 2008
Posts: 1,515 |
That's really good challange!! Good idea SReject!
|
|
|
|
Joined: Apr 2010
Posts: 969
Hoopy frood
|
OP
Hoopy frood
Joined: Apr 2010
Posts: 969 |
NOTICEWould 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.
|
|
|
|
Joined: Apr 2010
Posts: 969
Hoopy frood
|
OP
Hoopy frood
Joined: Apr 2010
Posts: 969 |
TEST ALIAS UPDATEThere is a bug in the test alias from the original post, the following fixes that bug and will be used to test entries: 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.
|
|
|
|
Joined: Dec 2015
Posts: 148
Vogon poet
|
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: 255
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 255 |
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
Hoopy frood
|
OP
Hoopy frood
Joined: Apr 2010
Posts: 969 |
For the Non-Encode Catagoryare 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: ;; this is fine:
$calc($NativeThing + $NativeThing2)
;;This isn't fine:
$NativeThing(=+=) 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.
|
|
|
|
Joined: Nov 2009
Posts: 295
Fjord artisan
|
Fjord artisan
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.
|
|
|
|
Joined: Apr 2010
Posts: 969
Hoopy frood
|
OP
Hoopy frood
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.
|
|
|
|
Joined: Apr 2010
Posts: 969
Hoopy frood
|
OP
Hoopy frood
Joined: Apr 2010
Posts: 969 |
RESULTSSo after two weeks of tinkering there is a winner ... ... ... Saturn for both categories!! Pastebin of all EntriesEncode/Decode Results1. Saturn - Quakenet - 36 bytes - The $hmac contains \x2F\x03\x14 alias numbers return $or($hmac(/)) 2. Spling - SwiftIRC - 43 bytes - First $asc contains: \u3490 - Second $asc contains: \u5135 alias numbers return $asc(㒐) $+ $asc(儵) 2. pball - Forums - 43 bytes - First $asc contains: \u4F79 - Second $asc contains: \u4195 alias numbers return $asc(佹) $+ $asc(䆕) 2. Wims - SwiftIRC - 43 bytes - First $asc contains: \u3034 - Second $asc contains: \uDDD5 - - The character is a unicode lower surrogate and requires some fanagling alias numbers return $asc(〴) $+ $asc(򅐩) 5. NiLon - QuakeNet - 45 bytes alias numbers return $decode(*.#`R-#$U-SDS-@) 6. Dazuz - Forums - 48 bytes alias numbers return $decode(OTgzNzYyNTQxMA==,m) 7. FroggieDaFrog - 51 bytes - First $asc contains: \u04D2 - Second $asc contains: \u0237 - Third $asc contains: \u037A alias numbers return $+($asc(Ӓ),$asc(ȷ),$asc(ͺ)) 8. bindi - Quakenet - 53 bytes alias numbers return $base(NHOKIA,$asc(##),$asc($lf)) 9. Westor - SwiftIRC - 139 bytes 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 Results1. Saturn - QuakeNet - 48 bytes alias numbers return $hash($~ $remote $cr,$bits) 2. Wims - SwiftIRC - 71 bytes alias numbers return $regsubex($readn $pi,/(?<a>\d)(?=.*\k<a>)|[. ]/g,) 3. Dazuz - forums - 74 bytes alias numbers while ($len(%r) < $asc($lf)) %r = %r $+ $ifmatch | return %r 4. NiLon - QuakeNet - 75 bytes alias numbers return $regsubex($hmac($cid),/\D+|(\d)(?=.*?\ $+ $cid )/gx,) 5. pball - forums - 92 bytes 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.
|
|
|
|
Joined: Jul 2006
Posts: 4,213
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 4,213 |
#mircscripting @ irc.swiftirc.net == the best mIRC help channel
|
|
|
|
Joined: Apr 2004
Posts: 871
Hoopy frood
|
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
Hoopy frood
|
OP
Hoopy frood
Joined: Apr 2010
Posts: 969 |
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!
|
|
|
|
Joined: Oct 2003
Posts: 34
Ameglian cow
|
Ameglian cow
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
|
Hoopy frood
Joined: Dec 2008
Posts: 1,515 |
ahhaha LOL! very clever method!!! good job guys!
|
|
|
|
Joined: Jan 2004
Posts: 2,127
Hoopy frood
|
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.
alias numbers return $hash($sreq $$ $cr,$bits)
|
|
|
|
|