Results:
*drum rolls* and here is what you have been waiting for ladies, gentlemen and those in-between...
There were a total of
30 entries of which
10 were valid and
20 invalid.
I'd like to thank you all for your lovely comments, and to Memo for the cyber.
Winner!
Panthouffle (196 bytes)
alias isdate {
if $count($1,/,.,+) = 2 tokenize 47 $1
return $iif($1 isnum 1- $iif($2 = 2,$iif(4 // $3 && 25 \\ $3 || 16 // $3,29,28),$iif($or($2,6) isin 615,30,31)) && $2 isnum 1-12 && 1 // $3,1,0)
Worthy Mention:
My heart goes out to those who failed by the narrowest of narrow margins: jaytea, scriptwiki, myndzi, |ur|, Ubiratan, LoCkZiN, Mazza and Memo. Shame on you if yours is the script that gave "/if: amiguous format".
In actual fact, scriptwiki was tagged as the winner until I looked at their code and realised that it would fail on 1a/1/1 since they used $calc.
%Big_up_to_visionz_my_dear_cute_friend
In the next challenge:
When I do the next challenge I will give many more examples for you to work with. I will also have a new
FAQ section that should answer any question you might have instead of trolling around in the forum.
Winner: Panthouffle 196 bytes!
Top Entries
Invalid Entries
| jaytea | 170 bytes | * failed on 1 test: 35 |
| scriptwiki | 178 bytes | * failed on 1 test: 43 |
| zzattack | 208 bytes | * uses regex, against the rules |
| myndzi | 215 bytes | * failed on 1 test: 26 |
| |ur| | 215 bytes | * failed on 1 test: 34 |
| Ubiratan | 233 bytes | * failed on 1 test: 25 |
| A I R U S | 235 bytes | * failed on 4 tests: 26, 33, 34, 36 |
| Thizar | 245 bytes | * failed on 2 tests: 3, 25 |
| LoCkZiN | 251 bytes | * failed on 1 test: 3 |
| novatech | 258 bytes | * failed on 3 tests: 25, 37, 42 |
| squirk | 259 bytes | * failed on 4 tests: 25, 26, 35, 36 |
| w35l3y | 265 bytes | * /if: ambiguous format (line 2) |
| guestwho | 268 bytes | * failed on 4 tests: 14, 16, 19, 23 |
| Hanns-Q | 301 bytes | * failed on 6 tests: 20, 22, 36, 38, 39, 40 |
| Mazza | 333 bytes | * failed on 1 test: 25 |
| Jrf | 341 bytes | * failed on 3 tests: 20, 33, 34 |
| Asterix_UO | 389 bytes | * failed on 2 tests: 25, 35 |
| Memo | 411 bytes | * failed on 1 test: 26 |
| blink | 416 bytes | * failed on 6 tests: 12, 20, 22, 38, 39, 40 |
| tryitwice | 588 bytes | * /if: ambiguous format (line 1) |
| DjMadness | 1081 bytes | * /if: ambiguous format (line 3) |
Description:
Hey guys. I'm sorry there has not been a challenge for a long time but I've been very busy. But anyway, here is the new challenge! :D
In this challenge you are asked to code an $isdate() alias that will return if a particular date is valid or not (taking into consideration leap years).
You will assume that the format will always be dd/mm/yyyy - however you may accept 1 instead of 01 in the date and month, but not 07 instead of 2007 in the year. In other words, since in 0008 there is only 1 significant figure, that should be taken. Checking of this length is unnecessary. If there are more than 2 digits for d, but they are insignificant - ignore them.
Note: this alias will be based on the Gregorian calendar. Dates will be tested all the back to 1/1/1 (01/01/0001) and to the future 31/12/9999. Checking to see if the date is within this range is unnecessary.
Example:
$isdate(a/a/a) = 0
$isdate(/12/2007) = 0
$isdate(0.1/5/2007) = 0
$isdate(30.1/01/1800) = 0
$isdate(.30/9/1500) = 0
$isdate(01/01/2007) = 1
$isdate(1/1/2007) = 1
$isdate(30/2/2000) = 0
$isdate(29/2/2000) = 1
$isdate(29/2/2001) = 0
$isdate(31/04/2010) = 0
$isdate(29/02/1700) = 0
$isdate(29/02/1600) = 1 |
Rules:
Alias name must be 'isdate'
Alias MUST return 0 if date is invalid or 1 if its valid.
No dlls, coms, sockets, regular expressions, $ctime $asctime, or $duration
One submission per user.
Your code will be taken for EXACTLY as submitted. Nothing will be changed in your submitted code - even if a subtle mistake is found.
Alias will be run on mIRC v6.21.
Script must give correct results after consecutive runs.
File will be loaded into the remotes section.
File we will be using to count the code: countcode.php
Code which exploits countcode will be rejected.
Alias will be run on a mIRC with no variables set - a clean mIRC.
Entries will be judged on code size and whether they return the correct result (1 for valid date 0 for invalid).
Feel free to ask any questions in the forum below.
Good luck!