|
|||||||
New to SitePoint Forums? Register here for free!
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
SitePoint Wizard
![]() ![]() Join Date: Nov 2000
Location: Switzerland
Posts: 2,898
|
This came up a while back but reckon it's time to give it a try. Start with some simple rules and see what happens.
1. First person serves with a script from the Zend Code gallery 2. Each return must; a. Make the previous code more efficient / minimalistic b. Add one piece of functionality to the code that wasn't there before. c. Not add / delete more than 3 lines to the previous code and must not change more than 6 lines overall (including adds / deletes). Other Stuff If you can't meet the requires of 2. or you post code with a bug in it, you lose! If you're caught editing your post, you also lose (ed: I just lost - was updating the rules honest!). You don't have to comment code and if the origional from Zend has comments, you can delete them to save lines. You may not use includes or require or reference any external PHP source (e.g. dB using eval() - all code most be part of a single script. Finally, this is not allowed;PHP Code:
If that sounds fair enough, I'll start with the first serve, with Source viewer PHP Code:
Last edited by HarryF; Jul 10, 2002 at 18:20.. |
|
|
|
|
|
#2 |
|
morphine for a wooden leg
![]() ![]() ![]() ![]() ![]() Join Date: Jun 2002
Location: .chicago.il.us
Posts: 957
|
Okay... I'll bite.
PHP Code:
|
|
|
|
|
|
#3 | |
|
morphine for a wooden leg
![]() ![]() ![]() ![]() ![]() Join Date: Jun 2002
Location: .chicago.il.us
Posts: 957
|
Re: Anyone for PHP Tennis?
Quote:
And if we find security holes, should we try to license the code to Microsoft? :-) |
|
|
|
|
|
|
#4 |
|
SitePoint Guru
![]() ![]() ![]() ![]() ![]() Join Date: Mar 2002
Location: US
Posts: 633
|
PHP Code:
![]() |
|
|
|
|
|
#5 |
|
SitePoint Guru
![]() ![]() ![]() ![]() ![]() Join Date: Mar 2002
Location: US
Posts: 633
|
Err stupid me forgot one thing. Well sicne we can't edit by rules I'd thouht I'll post the updated version.
PHP Code:
|
|
|
|
|
|
#6 | |
|
SitePoint Wizard
![]() ![]() Join Date: Nov 2000
Location: Switzerland
Posts: 2,898
|
Alright!
Quote:
PHP Code:
|
|
|
|
|
|
|
#7 |
|
SitePoint Wizard
![]() ![]() Join Date: Nov 2000
Location: Switzerland
Posts: 2,898
|
Aaarrgggh!
PHP Code:
|
|
|
|
|
|
#8 |
|
SitePoint Wizard
![]() ![]() Join Date: Nov 2000
Location: Switzerland
Posts: 2,898
|
Wait a second! OK - no problem - was thinking this would be one on one so my response is to randem.
We could of course start playing via CVS ![]() Anyway - I got a catch some sleep so may be you want to take over Codename49? |
|
|
|
|
|
#9 |
|
morphine for a wooden leg
![]() ![]() ![]() ![]() ![]() Join Date: Jun 2002
Location: .chicago.il.us
Posts: 957
|
Volley !
PHP Code:
|
|
|
|
|
|
#10 |
|
SitePoint Wizard
![]() ![]() Join Date: Nov 2000
Location: Switzerland
Posts: 2,898
|
Ouch! Sly use of a class. HarryF's gonna have to streach to return that one...
|
|
|
|
|
|
#11 |
|
+
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2001
Location: Adelaide, Australia
Posts: 6,509
|
how about posting some links to a working page
![]() |
|
|
|
|
|
#12 |
|
SitePoint Wizard
![]() ![]() Join Date: Nov 2000
Location: Switzerland
Posts: 2,898
|
Good point: http://www.pinkgoblin.com/test/tennis.php is this;
PHP Code:
|
|
|
|
|
|
#13 |
|
SitePoint Addict
![]() ![]() ![]() Join Date: Aug 2001
Location: lost, If you find me please return me to St.Louis
Posts: 396
|
in that link all I see is this:
<html> <head> <title> IP Check </title> </head> <body> <h2>IP Check</h2> <?php if ( ISSET ( $_SERVER[ Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/goblin/public_html/test/tennis.php on line 10 'HTTP_X_FORWARDED_FOR\'] ) ) { echo ( \"<p>HTTP_X_FORWARDED_FOR: \" . $_SERVER[\'HTTP_X_FORWARDED_FOR\'] . \" Hostname: \" . gethostbyaddr($_SERVER[\'HTTP_X_FORWARDED_FOR\']) ); } else { echo ( \"<p>HTTP_X_FORWARDED_FOR not set\" ); } if ( ISSET ( $_SERVER[\'HTTP_CLIENT_IP\'] ) ) { echo ( \"<p>HTTP_CLIENT_IP: \" . $_SERVER[\'HTTP_CLIENT_IP\'] . \" Hostname: \" . gethostbyaddr($_SERVER[\'HTTP_CLIENT_IP\']) ); } else { echo ( \"<p>HTTP_CLIENT_IP not set\" ); } if ( ISSET ( $_SERVER[\'REMOTE_ADDR\'] ) ) { echo ( \"<p>REMOTE_ADDR: \" . $_SERVER[\'REMOTE_ADDR\'] . \" Hostname: \" . gethostbyaddr($_SERVER[\'REMOTE_ADDR\']) ); } else { echo ( \"<p>REMOTE_ADDR not set\" ); } ?> </body> </html> Last modified: 28-Jun-2002 05:43:42
__________________
You smell something? |
|
|
|
|
|
#15 |
|
SitePoint Wizard
![]() Join Date: Jan 2002
Location: Canada
Posts: 6,399
|
PHP Code:
__________________
- Nathan |
|
|
|
|
|
#16 |
|
morphine for a wooden leg
![]() ![]() ![]() ![]() ![]() Join Date: Jun 2002
Location: .chicago.il.us
Posts: 957
|
Sorry, can't post a link. I'm at work, and putting this on our server wouldn't go over too well. :-)
PHP Code:
|
|
|
|
|
|
#17 |
|
SitePoint Wizard
![]() ![]() Join Date: Nov 2000
Location: Switzerland
Posts: 2,898
|
PHP Code:
To all the "spectators" out there; this is an expirmental game derived from the Photoshop Tennis forum (wierd that is too). If it looks good, may be we can request a "Server-side Tennis" Forum (no doubt those ASP coders will want to get in on the action). |
|
|
|
|
|
#18 |
|
SitePoint Wizard
![]() Join Date: Sep 2001
Location: Singapore
Posts: 5,312
|
yay! we've finally got a Tennis match going around here... never really figured how that worked at the Graphic design forums so i'm gonna read this thread out again...
![]() i'm game... just let me get my racket ![]() |
|
|
|
|
|
#19 |
|
SitePoint Wizard
![]() ![]() Join Date: Nov 2000
Location: Switzerland
Posts: 2,898
|
Seems to work ok as well. The "no more than 6 lines changed limit" seems to work. Phew - getting tough now - got a further optimisation in mind and an extra piece of functionality, but try make them both work by only changing six lines aint happening yet.
|
|
|
|
|
|
#20 |
|
SitePoint Wizard
![]() Join Date: Jan 2002
Location: Canada
Posts: 6,399
|
Ok, since you posted 1 minute after me, I think I'll modify mine what I said before, to teh way yours is, if that makes any sense!
![]() PHP Code:
People dont' want those slashes in teh soource! Harry, maybe you can upload this one? I wan tto see it. ![]()
__________________
- Nathan |
|
|
|
|
|
#21 |
|
SitePoint Wizard
![]() Join Date: Sep 2001
Location: Singapore
Posts: 5,312
|
one thing i don't get is how putting things in a class would make the code more efficient or minimalistic... but since we went the OO way, i'll jump in and make a return!
![]() PHP Code:
actually i don't see how 'Add one piece of functionality to the code that wasn't there before.' and 'Make the previous code more efficient / minimalistic' can co-exist in the ruls ![]() - Joel |
|
|
|
|
|
#22 |
|
SitePoint Wizard
![]() Join Date: Sep 2001
Location: Singapore
Posts: 5,312
|
oops someonewhois posted while i was writing...
and i seem to have broken the 6 lines limit... discount that for the fact that i added 2 properties? |
|
|
|
|
|
#23 | |
|
SitePoint Wizard
![]() ![]() Join Date: Nov 2000
Location: Switzerland
Posts: 2,898
|
What is this? A pitch invasion!?!
Quote:
And this; PHP Code:
Nice angle of more error reporting though - could constitute extra functionality I guess. OK - you carry on - I'm gonna go hunting for an Open Source "diff" tool (checks the difference between two files) to act as the referee. |
|
|
|
|
|
|
#24 |
|
SitePoint Wizard
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Nov 2001
Location: Atlanta, GA, USA
Posts: 5,024
|
Wow, this isn't a tennis match, it's like a giant PHP Battle Royale with new people charging in from the locker room every few minutes! Look out for the folding chairs!
Seriously, this is great... a fun way to get more efficient and creative code... I'm enjoying spectating.
__________________
Using your unpaid time to add free content to SitePoint Pty Ltd's portfolio? |
|
|
|
|
|
#25 |
|
SitePoint Wizard
![]() ![]() Join Date: Nov 2000
Location: Switzerland
Posts: 2,898
|
"Just when they thought he was down, HarryF storms back with that killer forehand!"
Check this out! Refinement - those irritating slashes now gone (**cough** thanks someonewhois) and bam - line numbering, with a devilishly constructed for loop. Bring it on randem! PHP Code:
We should also set some rules on indents and use of curly braces perhaps. But then again perhaps not - if you want to indent a line by 10 characters for example, that's fine - you force the other player to waste one line of their changes in reducing the indent. |
|
|
|
![]() |
| Bookmarks |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
|
All times are GMT -7. The time now is 09:23.





- was updating the rules honest!). You don't have to comment code and if the origional from Zend has comments, you can delete them to save lines. You may not use includes or require or reference any external PHP source (e.g. dB using 



// 




Linear Mode
