This will be a three part challenge. Judged on smallest code, most creative, and most complete. So, there will be 3 winners. It is possible for one person to win in more than one category, but not likely :P
Smallest code winner to be determined by size of code, in bytes, not counting spaces, linefeed or carriage return ($lf and $cr or $crlf) characters.
Most creative winner to be determined by judges. Whining about your entry being more creative than the winner is not acceptable.
Most complete winner to be determined by the total number of calculator functions the alias can reproduce ACCURATELY and without breaking the rules.
For example, if you have 10 functions in your alias but only 8 of them work 100% correctly, only 8 will be counted.
If two entries have the same number of working functions, the entry with the smallest size will be determined the winner.
Immediate disqualification for using $encoding tricks and whatnot, cheap tricks like that make it less fun
for everyone (definition of "cheap" to be decided by judges).
Requirements for all three categories:
You must include accurate functions for addition, subtraction, multiplication and division. An entry for the "most complete" will probably have more, but the basic four are all that is needed.
You may not use /inc, /hinc, /dec, /hdec (or anything similar), or, of course, $calc. if you are unsure about the legality of a function, contact a judge privately so as not to tip other contestants off about your technique. any function deemed "illegal" will be added to the list here.
All four functions must be "stand alone", i.e. the alias must not call its own addition function to do multiplication, and so on.
Must use standard $calc operational signs, + for addition, - for subtraction, * for multiplication and / for division.
All entries must accept at least three parameters: the first number, the operational sign (+ - * /), and the second number (i.e. $calc2(1 + 2)). all three parameters must be separated by a space (i.e. $calc2(2+1) is unacceptable). again, a "most complete" entry will accept more, but three is the minimum.
Additional Rules and Notes:
Setting variables to do calculations isn't allowed. For example, /var %variable = 1 + 1 wouldn't be allowed.
Negative numbers in calculations should be supported.
DLLs, COM objects, and sockets shouldn't be used.
The identifier (alias name) should be "calc2"; this will make it easier to test and judge.
The filename of the entry should be yournick-challenge.mrc. For example, praetorian-challenge.mrc.
While loops CAN be used, just not with /inc or /dec or any of the other unallowable things mentioned above.
For division, you must return your answer in the format N r R, where N is the number of times the second number goes into the first, and R is the remainder. you are not expected to calculate decimal points.
Entries will be tested using single and double digit numbers so as not to interfere with certain limits mIRC has.
This contest requires some abstract thinking, so have fun with it.
Challenge Results:
Sorry for the delay in judging all of the entries. This was a tough challenge, there were only 16 entries total.
Bytes were calculated using a modified countcode.mrc (which removes
commented lines.)
Kickchon's
entry was closely followed by Buddyke's
as the most complete. However, Kickchon's had the edge by
supporting brackets, exponents, multiple operations, order of
operations, percentage calculation, and decimals. Buddyke's entry
supported multiple operations, order of operations, percentages,
and division by zero returned "UNDEFINED". He also had bracket
support but they didn't work properly, failing on $calc2((4 + 2) *
8).
All of the entries basically used the same method; with $abs,
$len, binary files, etc. myndzi's
entry and Buddyke's were the only two to not use binary files.
We decided myndzi's was the most creative because although
Buddyke's entry didn't use binary files, it didn't show much
creativity and was basically "get-it-done" scripting. Both of their
entries worked 100 percent.
Other valid entries
Arcane,
^BeAsT^,
Buddyke,
and Eric^^
all had entries that didn't fail any tests and weren't
disqualified, but didn't win any of the three categories.