Sharing some stats about your code?

Add a reply

Posted by flevour 926 days ago:
Hi everybody,
anyone willing to share some info about his code (if not his code at all).
I am doing this in Ruby in 76B and I use:
- 20 to get input
- 13 to convert strings to numbers
- 11 to output the result
- remaining 32B is for algorhythm
I wonder if any Rubyst around there could suggest ways to improve in any of these categories.
Cheers,
Francesco
Posted by bnovc 925 days ago:
Language: PHP
Bytes: 62
Input: 30 (I hate this!)
Processing: 26
Output: 6
Posted by gnuvince 924 days ago:
Python
Total: 56
Input: 7
Processing: 40
Output: 9
Posted by o0lit3 922 days ago:
Language: Perl
Bytes: 37

Dividing code into separate sections is a bit difficult with Perl. The input, output, and processing sections all overlap to create the final solution.

If pressed, I suppose I would say:

Input/Output: 10 Bytes
Processing: 27 Bytes
Posted by o0lit3 922 days ago:
- 13 to convert strings to numbers
-Francesco

I'm not very proficient in Ruby, but you shouldn't need to convert strings to numbers. Applying mathematical functions to number-like strings should be enough to do the conversion for you.

Cheers,
o0lit3

Posted by Jack 922 days ago:
Python

Input: 11
Processing: 33
Output: 7

And another 2 for separators.

Apparently someone in Python has gotten it down to 39, and I am completely stumped to how they could possibly do it. I'm only 2 off the previous optimal of 51.
Posted by wendelscardua 921 days ago:
Perl

I'm stuck at 45 chars

11 for the input/output
34 for the processing

I'm able to change processing to 25 chars (-9), but that increases i/o in more than 9 chars -_-'

I'm so curious about how people can solve those problems... Too bad there's no way to see the submitted codes :-(
Posted by gnuvince 917 days ago:

I'm so curious about how people can solve those problems... Too bad there's no way to see the submitted codes :-(

What are you talking about? Use your m4d l33t hax04 skillz to hack the Gibson and get every answer you want :)
Posted by ManiacDan 682 days ago:
Unfortunately my PHP isn't the best, but I did manage to get less code for input parsing that bnovc:
Language: PHP
Input: 27
Processing: 62 (ugly)
Output: 14
Posted by Dilb 682 days ago:
So, here is mine:
language: Python
Total: 39
input: 11
processing/output: 26
misc: 2
Posted by ManiacDan 681 days ago:
I'd love to see the algorithm you guys came up with for the choose function in PHP. Mirroring the recursive definition given in wikipedia, I got it down to 61 characters, but that's far too large.

Input: 18
Processing: 61
Output: 20 (includes some code that could be considered input parsing)
Posted by MyrddinE 638 days ago:
Ruby

Input: 21 characters
To Int: 20 characters
Factorial: 29 characters
Equation: 16 characters
Output: 4 characters

Total: 91 characters of shame. There are some serious shortcuts for input, in particular, that I obviously don't know yet. The algorithm I'm using is naive and can be improved, but I don't know how to have a more compact input/to int routine... 41 characters to read STDIN is a joke, considering other ruby attempts have the entire answer done in that many characters.
Posted by 3n1gm4 519 days ago:
So, here is mine:
language: Python
Total: 39
input: 11
processing/output: 26
misc: 2

just HOW? :O

I'm sure i'm using the wrong alg.

Lang: Python
input: 11
factorialt: 28
print/"logic": 22
misc: 3

I'm sure there is a shorter version without using factorial, just need to find out how :P
Posted by fuliculi 354 days ago:
python:
total of 39 bytes
input:12bytes
print:5bytes
computation:22bytes
Posted by torkel 219 days ago:
Total: 58 bytes
Input: 25 bytes :-(
Processing: 26 bytes
Output: 7 bytes
Posted by torkel 219 days ago:
Language Perl

Add a reply