|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
[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 D Fatal error: Maximum execution time of 60 seconds exceeded in D -------------------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 |
|
#2
|
|||
|
|||
|
[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. |
|
#3
|
|||
|
|||
|
[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 |
|
#4
|
|||
|
|||
|
[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... |
|
#5
|
|||
|
|||
|
[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
|
|
#6
|
|||
|
|||
|
[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 ? |
|
#7
|
|||
|
|||
|
[Risk] RE: Maximum execution time
There is no chance of getting that script
|
|
#8
|
|||
|
|||
|
[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.
|
|
#9
|
||||
|
||||
|
[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.
|
![]() |
| Viewing: Codewalkers Forums > PHP Contests > Older Contests > [Risk] Maximum execution time |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|