SunQuest
           Older Contests
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP ContestsOlder Contests

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old July 16th, 2003, 12:49 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
[Risk] Maximum execution time

Hi xs0,

I just had a strange battle case where the script1 (this script is an own testscript) runs in an endless loop.
My timeout is set to 60 seconds. After 60 seconds I got this message in my browser:
-------------------8<--------------
Warning: file(http://spiderman/php/tests/phpcontest/testgame/script1/risk.php?start=1&youare=a&board=x,x,a1,a1,x,x,x,x,a1,x,x,x,x,x,a1,x,x,x,a1,a 1,x,x,x,x,a1,x,x,x,x,x,x,x,a1,x,x,x,a1,x,x,a1): failed to open stream: HTTP request failed! ðˆúwЗo in DrogrammeApache2htdocsphptestsphpcontesttestgame judge.risk.php on line 150

Fatal error: Maximum execution time of 60 seconds exceeded in DrogrammeApache2htdocsphptestsphpcontesttestgame judge.risk.php on line 150
-------------------8<--------------

The judge.risk.php was ended and the game can not be played !
What will you do in such a case with the points ?

Perhaps you can do a improvement in judge.risk.php to avoid this, and go to the next script, so that the game can be finished.

You can simulate this error case, if you write a "while(1);" in the first line of script1/risk.php

Bye
Mario

Reply With Quote
  #2  
Old July 16th, 2003, 03:51 PM
bearca bearca is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 17 bearca User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
[Risk] RE: Maximum execution time

I don't know how xs0 plans on handling this...

In the first place, your php.ini timeout should be at 15 seconds, not 60, assuming you want to simulate your script as it will run on the judging machine.

But here is one way:

Put the function: set_time_limit( int seconds) at the top of the judge.risk.php, with however many seconds you plan on allowing the judging script to run.

Reply With Quote
  #3  
Old July 16th, 2003, 04:22 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
[Risk] RE: Maximum execution time

But if I set the maximum execution time in php.ini to 15 seconds, this
is also valid for the judge.risk.php. So the complete judge.risk.php with
all turns have to be finished in 15 seconds.
The call to the single scripts doesn't fork a new php process, they all
run in the context of judge.risk.php. So if we say we want to play maximal
100 turns, that means we need to set the maximum execution time for
judge.risk.php to 100 x 15 = 1500 seconds :-/ But then we have not the
control that one single script runs under 15 seconds.

A possible solution would be, that the judge.risk.php will call itself
again and again with different GET parameters for each single turn.
Then the 15 seconds would be okay, because each judge.risk.php call
which internally calls the right script is allowed to run maximal 15 seconds.

xs0, I think you will have a lot of work with this problem. Sorry, that
I post this problem here.

-
Mario

Reply With Quote
  #4  
Old July 16th, 2003, 04:24 PM
Matt Matt is offline
Moderator
Codewalkers Specialist (4000 - 4499 posts)
 
Join Date: Apr 2007
Location: Florida
Posts: 4,158 Matt User rank is Private First Class (20 - 50 Reputation Level)Matt User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 10 m 20 sec
Reputation Power: 6
[Risk] RE: Maximum execution time

You can also always set the max execution time in the judge script with:

set_time_limit(0);

That would turn off limits for just that script...

Reply With Quote
  #5  
Old July 17th, 2003, 08:19 AM
xs0 xs0 is offline
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: Ljubljana, Slovenia
Posts: 760 xs0 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
[Risk] RE: Maximum execution time

The posted script is not the script I'll be using. In case of invalid output, it will be simply ignored, as the rules say (invalid commands are ignored, and an error message is an invalid command ).

Reply With Quote
  #6  
Old July 17th, 2003, 03:13 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
[Risk] RE: Maximum execution time

Okay, I understand.

Do you already have this judge script with which you will execute
the battles ? Is there a chance to get this script ?

Reply With Quote
  #7  
Old July 17th, 2003, 03:18 PM
xs0 xs0 is offline
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: Ljubljana, Slovenia
Posts: 760 xs0 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
[Risk] RE: Maximum execution time

There is no chance of getting that script

Reply With Quote
  #8  
Old July 19th, 2003, 08:00 PM
webhappy webhappy is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Silicon Valley, CA, USA
Posts: 203 webhappy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
[Risk] RE: Maximum execution time

It's probably the same. He just doesn't want lamers to try to think up ways to circumvent security measures in the judge code.

Reply With Quote
  #9  
Old July 21st, 2003, 07:06 AM
bakertrg's Avatar
bakertrg bakertrg is offline
Contributing User
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: Scottsdale AZ, US
Posts: 2,253 bakertrg User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 48 m 45 sec
Reputation Power: 4
Send a message via Yahoo to bakertrg
[Risk] RE: Maximum execution time

It seems to me we spend a lot of time discussing lame methods of circumventing the spirit of the contest. It's pretty simple really, write some php code that plays the modified game of risk that is described in the rules. Anything else beyond playing the game as well as you can teach the script to play it is cheating. I don't know why people always spend time asking if they can open files in other directories, use sessions when you have been told to write to one and only one file or even determine who is in your game and not attack them (this should be cheating as well) because of a pregame alliance demonstrates some very poor sportsmanship. It's a coding contest, write code that does what the contest describes, don't try and reverse engineer the judging script. It sure would have been nice if we could have the real judging script but the players who want to exploit the game ruin it for us all.


Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP ContestsOlder Contests > [Risk] Maximum execution time


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway