[ANN] Code Golf Challenge : 1,000 Digits Of Pi

C

Carl Drinkwater

Hi all,

Code Golf's 12th challenge has just been added to the site. It asks you
to calculate the first 1,000 digits of Pi - Something I'm sure most of
you have thought about, but never done. You can see the challenge at :

http://codegolf.com/1000-digits-of-pi

For those who haven't heard of codegolf.com, it can be described as
"allowing you to show off your code-fu by trying to solve coding
problems using the least number of keystrokes."

The site currently supports Perl, PHP, Python and Ruby with Scheme to
(hopefully) follow soon. Your entries are automatically executed and
scored - No need to wait for someone to validate your code.

Other challenges include implementing the Vigenere Cipher, Prime
factors, SHA-256 Hashing as well as the obvious 99 Bottles Of Beer. All
of the challenges are competitive but there is still scope to well in
them, even if you're new to the site.

I hope some of you will find this interesting, and sorry for disturbing
you if not!

Have fun,
Carl.
 
M

mensanator

Carl said:
Hi all,

Code Golf's 12th challenge has just been added to the site. It asks you
to calculate the first 1,000 digits of Pi - Something I'm sure most of
you have thought about, but never done. You can see the challenge at :

http://codegolf.com/1000-digits-of-pi

For those who haven't heard of codegolf.com, it can be described as
"allowing you to show off your code-fu by trying to solve coding
problems using the least number of keystrokes."

The site currently supports Perl, PHP, Python and Ruby with Scheme to
(hopefully) follow soon. Your entries are automatically executed and
scored - No need to wait for someone to validate your code.

Other challenges include implementing the Vigenere Cipher, Prime
factors, SHA-256 Hashing as well as the obvious 99 Bottles Of Beer. All
of the challenges are competitive but there is still scope to well in
them, even if you're new to the site.

I hope some of you will find this interesting, and sorry for disturbing
you if not!

Have fun,
Carl.

Here's a thought: for your next contest, why not issue a
challenge to see who can write a scoreboard
that actually works?



Overall:

This Challenge's Best Entries [View All]
(View the Overall | Perl | PHP | Python | Ruby leaderboard.)

Rank User Size Language Score [?]
1st primo 62 Ruby 10,000 (v12)
2nd jix 65 Ruby 9,538 (v7)
3rd MadOnion 92 Ruby 6,739 (v4)
4th jojo 112 Ruby 5,535 (v6)
5th zeriod 134 Ruby 4,626 (v6)
6th kmeyer 151 Ruby 4,105 (v3)
7th dseverin 159 Ruby 3,899 (v7)
8th bearophile 165 Python 3,757 (v5)
9th ToastyX 167 Php 3,712 (v20)
10th Leafy 181 Php 3,425 (v8)


Perl:

This Challenge's Best Entries [View All]
(View the Overall | Perl | PHP | Python | Ruby leaderboard.)

Rank User Size Language Score [?]
1st _W_ 183 Perl 10,000 (v2)
2nd jojo 524 Perl 3,492 (v2)
3rd zeriod 1,009 Perl 1,813 (v7)


PHP:

This Challenge's Best Entries [View All]
(View the Overall | Perl | PHP | Python | Ruby leaderboard.)

Rank User Size Language Score [?]
1st ToastyX 167 Php 10,000 (v20)
2nd Leafy 181 Php 9,226 (v8)
3rd jojo 539 Php 3,098 (v3)
4th Theory 660 Php 2,530 (v1)
5th zeriod 1,002 Php 1,666 (v1)
6th skauert 1,002 Php 1,666 (v1)
7th Makan 1,002 Php 1,666 (v1)
8th _W_ 1,002 Php 1,666 (v4)
9th Stormx 1,004 Php 1,663 (v3)


Python:

This Challenge's Best Entries [View All]
(View the Overall | Perl | PHP | Python | Ruby leaderboard.)

Rank User Size Language Score [?]
1st primo 69 Python 10,000 (v11)
2nd bearophile 165 Python 4,181 (v5)
3rd jojo 557 Python 1,238 (v1)


Ruby:

This Challenge's Best Entries [View All]
(View the Overall | Perl | PHP | Python | Ruby leaderboard.)

Rank User Size Language Score [?]
1st primo 62 Ruby 10,000 (v12)
2nd jix 65 Ruby 9,538 (v7)
3rd MadOnion 92 Ruby 6,739 (v4)
4th jojo 112 Ruby 5,535 (v6)
5th zeriod 134 Ruby 4,626 (v6)
6th kmeyer 151 Ruby 4,105 (v3)
7th dseverin 159 Ruby 3,899 (v7)
8th will 544 Ruby 1,139 (v4)
 
P

Paddy

Carl said:
For those who haven't heard of codegolf.com, it can be described as
"allowing you to show off your code-fu by trying to solve coding
problems using the least number of keystrokes."
Is having good 'code-fu' worthwhile? It may be trivial to score but do
the results show who iss the better programmer?

Methinks I'll pass.
 
B

bearophileHUGS

Paddy:
Is having good 'code-fu' worthwhile? It may be trivial to score but do
the results show who iss the better programmer?

With Python you can't win, because Perl and Ruby allow for shorter
programs.
Beside the language, you win if you can invent more tricks, that you
have to avoid in real code, because it must be very readable.
The positive side of this game is that you exercise yourself, so you
get to know the programming language better, and you learn all the
corner cases of your language. Knowing them is useful, to avoid them
when you program for real, to avoid some kind of bugs generated by
corner cases.

Bye,
bearophile
 
P

Paul McGuire

Paddy:

With Python you can't win, because Perl and Ruby allow for shorter
programs.
Beside the language, you win if you can invent more tricks, that you
have to avoid in real code, because it must be very readable.
The positive side of this game is that you exercise yourself, so you
get to know the programming language better, and you learn all the
corner cases of your language. Knowing them is useful, to avoid them
when you program for real, to avoid some kind of bugs generated by
corner cases.

Bye,
bearophile

Success lies in the journey, not the destination.

or in Yoda-speak:

In the journey success lies, in the destination not.

-- Paul
 
P

Paddy

Paul said:
Success lies in the journey, not the destination.

or in Yoda-speak:

In the journey success lies, in the destination not.

-- Paul
Ah, I always wondered what lemmings thought , before splat!!! :)

- Pad.
 
P

Paul Rubin

With Python you can't win, because Perl and Ruby allow for shorter
programs.

Python has native bignums, which should simplify a program like this
enormously. I don't know if Ruby has them. Perl doesn't, and if you
use some CPAN library that simulates them, that should count as part
of your program size.
 
P

Paddy

Paul said:
Python has native bignums, which should simplify a program like this
enormously. I don't know if Ruby has them. Perl doesn't, and if you
use some CPAN library that simulates them, that should count as part
of your program size.

Unfortunately:

$ perl -Mbignum -e 'print
1234567890123456789012345678901234567890,"\n"'
1234567890123456789012345678901234567890

HP DV8025EA@PADDYS-HPLAPTOP /cygdrive/c/Documents and Settings/All
Users/Documents/Python tutorial
$ perl -v

This is perl, v5.8.7 built for cygwin-thread-multi-64int
(with 1 registered patch, see perl -V for more detail)


Yep my standard Cygwin perl installation for windows includes the
bignum package.

- Paddy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top