|
| Challenge: | Smallest Number to Text Converter |
| Started: | May 19th 2002 |
| Ends: | June 15th 2002 |
Challenge Results:
Overall a successfull challenge as far as visitor participation. Unfortunately there were a lot of questions with the rules as people created their entry. The hardest part about these type of challenges is covering every possibility.
There were 41 entries submitted with 16 valid entries. Out of the 16 valid entries 6 failed on 1 small error that was partly my fault. In the rules the limit on digits was 66, but in the numbertext form you could put any number of zeros and it would still return 'Zero'. I didn't want to disqualify those entries for this, I also didn't want to take away from the entries that knew and considered this bug. So each entry you see listed with a * means it is one of the semi-invalid entries.
Winner:
pai - 697 bytes - Congratulations pai!
Top Entries:
Invalid Entries:
| AnTr0-81 | 746 bytes | - Failed on a few typos: Houndred, Thirdteen. |
| Twister | 752 bytes | - Never worked due to a typo. Still failed after I fixed the typo on 1000000000000000000000000000000000000000000000000000000000000000001 returning one |
| Entr0py | 756 bytes | - Failed on 0999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999 not returning Invalid |
| heidelberger | 759 bytes | - Failed on 40 returning Fourty |
| Rich | 809 bytes | - Failed on 1000001 returning One Million Thousand One |
| xOliRu | 811 bytes | - Failed on 1000000000000000000000000000000000000000000000000000000000000000001 returning one illion one |
| clickhere | 813 bytes | - Failed on 1..2 not returning Invalid |
| Eric^^ | 819 bytes | - Failed on 1000000000000000000000000000000000000000000000000000000000000000001 returning one one |
| k0sm0s | 836 bytes | - Failed on 1.2.3 not returning Invalid |
| Geetee | 887 bytes | - Failed on 100 returning One Hundred 19 |
| Arcane | 936 bytes | - Failed on 999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999.123 returning Invalid |
| HENNESSY | 976 bytes | - Failed 100000000000000000000000000000000000000000000000000000000000000001 returning Invalid (One Hundred Vigintillion One) |
| platypus | 987 bytes | - Failed on 1000000000000000000000000000000000000000000000000000000000000000001 returning One MMillion One |
| pablissimo | 1067 bytes | - Failed on 1000000000000000000000000000000000000000000000000000000000000000001 returning one one |
| m0ussa | 1099 bytes | - Failed on 100001 returning One Hundred Thousand |
| qwert | 1134 bytes | - Failed on 1000 returning One Thousand q |
| facts | 1166 bytes | - First his filename is just 'numconv.mrc', also failed on 1000001 returning One Milion Thousand One |
| Ken | 1288 bytes | - Failed on .b returning Zero |
| DeaD | 1316 bytes | - Failed on , returning Invalid |
| smeller | 1331 bytes | - Failed on 2 returning two one (script never unset it's own variable) |
| Sarc | 1366 bytes | - Failed on 1 2 3 returning Invalid |
| skimp | 1423 bytes | - Failed on 1.2.3 not returning Invalid |
| captainEO | 1480 bytes | - Failed on 1000000000000000000000000000000000000000000000000000000000000000001 returning Oneillion One |
| Proph | 1614 bytes | - Failed on +1 not returning Invalid |
| Magnus | 2388 bytes | - Failed on 1000001 returning One Milion Thousand One |
| limitless | 2690 bytes | - Failed on 10001 returning Ten One |
Honorable Mention
warrior 228 bytes
I allowed warrior to send in his entry that sort of exploited the countcode script and endcoded his entry. This is not valid, but a clever idea and worth a mention.
Description:
In this challenge you're asked to convert any number to it's numeral term in smallest code possible.
For example:
12,345 would become Twelve Thousand Three Hundred Forty-Five
or
371,933,002 converted would be Three Hundred Seventy-One Million Nine Hundred Thirty-Three Thousand Two.
I understand there will be some differences in the numeral term for different languages.
For this challenge we will be using American English.
I created a form that does the same conversion for validation purposes.
Rules:
Only one script file (as in remote file) allowed. Each file must be named <yourname>_numbertext.mrc (eg. fubar_numbertext.mrc)
One entry per person. Don't ask if you can re-submit.
Entries must convert numbers exactly how the numbertext form does.
Names of numbers must be spelled correctly.
No socket connections.
All entries must use $numconv(<num>) to return your conversion. (eg. //echo -a $numconv(123) )
Must do error checking. Making sure only numbers get converted. '$numconv(blah)' should return an error.
All errors must return "Invalid" only.
Commas and decimal points must be allowed when converting. (eg. 12345 or 12,345 or 12,345.123 should be acceptable)
- Any number of commas are allowed.
- One decimal allowed, extra decimals is not a valid number: 12.32.32 = Invalid, 12.32 = Twelve
You do not have to convert decimals. Whole numbers is all we're looking for.
Only positive numbers. (eg. -100 = Invalid).
Number limit will be 66 digits. 999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999
Important: Each challenge will be judged by correct conversion and smallest code size. The size of each entry will be measured using a script that removes carriage returns, linefeeds, empty lines, trailing or ending spaces.
This will be the file we'll be using, countcode.mrc.
Update: There's been a lot of questions about spaces being used in your identifier. So I made a little change.. You now only have to worry about the first number entered.
For example:
" 1423 123 3312" should become One Thousand Four Hundred Twenty-Three
I also updated the numbertext form for this. Sorry for the confusion.
Info:
Here is a list of english names for numbers needed in order.
Zero, One, Two, Three, Four, Five, Six, Seven, Eight, Nine
Ten, Eleven, Twelve, Thirteen, Fourteen, Fifteen, Sixteen, Seventeen, Eighteen, Nineteen
Twenty, Thirty, Forty, Fifty, Sixty, Seventy, Eighty, Ninety
Hundred, Thousand, Million, Billion, Trillion, Quadrillion, Quintillion, Sextillion, Septillion, Octillion, Nonillion, Decillion, Undecillion, Duodecillion, Tredecillion, Quattuordecillion, Quindecillion, Sexdecillion, Septendecillion, Octodecillion, Novemdecillion, Vigintillion
FAQ:
If commas are used in the number to be converted do they have to be correct, as in 123,456,789 or can they be 1,2,3,4,5,65?
We're not going to be strict on the commas, only because they're optional. So you're basically removing them. You still must allow them with numbers as valid though.
Do the names have to be case sensitive?
Nope. For example you can do one thousand two hundred thirty-four. However they must be spelled correctly.
Why are there 3 different ways returned on the numbertext page?
That's just to make it optional for people that have a preference of using "," or "and" as a seperator.
What should .123 return?
Zero
What should +123 or -123 return?
Invalid
What happens if no parameters are supplied? ie. $numconv()
$numconv() shouldn't return anything. As in $null
What about spaces entered in $numconv()?
If you enter " 12 345" it should return Twelve. Only the first group of numbers separated by spaces should be evaluated.
Does the total length (66 digits) include numbers after the decimal point?
No, for example: 123.456 is 3 digits and 1,234.567 is 4 digits.
Contest Forum
Post a Question or Comment
You must be logged in to post. |