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 February 10th, 2003, 08:34 AM
steffan steffan is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 3 steffan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
some questions

Hi everybody!

To create the code I need some explanations...

1)As I supposed it will be a 6X6 grid and we must fill with words..
Must be all the grid completed and can be words put orizontal or vertical???

2)I am sorry but I don't understand the output method...

Thanks for bad english and for understanding..
Steffan

Reply With Quote
  #2  
Old February 10th, 2003, 12:35 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
RE: some questions

Every tile in the grid must have a letter on it. This does not mean that every letter will be used in a word.

Yes, words will run either horizontal or vertical. They must be readable from left to right or top to bottom.

What don't you understand about the output method?

Reply With Quote
  #3  
Old February 10th, 2003, 07:57 PM
fractalbit fractalbit is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 108 fractalbit User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: some questions

Hi, i am new here. Since there are so many opics already about the contest i thought to post my questions to this and not start a new one. I hope Matt will see it. Anyway on to the questions and clarifications.

"Output: The method of output is simply to output a very simple HTML file that has an opening html and body tag (each followed by a endofline), the total score of the board (again followed by an endofline), the number of words on the board (followed by a endofline), each word you created (each terminated by an endofline), and then a closing body and html tag (each also followed by an endofline)."

- I assume by endofline you mean br tags, no?
- Do we have the opportunity to print more info than the basic? For example print the grid?

"Judging: The winner will be the script that after 30 complete runs has the highest score computed by finding the sum of all 10 runs. The same 30 input.txt files will be used for all scripts."

- Did you mean : by finding the sum of all 30 runs? if it is 10 then i dont get it.
- To my understanding you will create 30 different input files with each of them having anywhere form 500 to 5000 words. You will then test all those 30 files with every valid contest submission. Am i correct here?
- Are you gonna check the results of each script? I mean someone could easily cheat and show a much higher than the actual scor. Maybe everyone should output the grid, so everyone could check if the results are valid.

And some general questions.
- If i submit my script and then improve it, can i send a second submission? Of course cancelling the first.
- Can you tell me if my script is valid to be in the contest if i submit the script?

Finally, here is some code to generate your own input files. I dont kno why some people have a problem figure this out, but anyway here it is :

php Code:
Original - php Code
  1.  
  2. $name = "input.txt";
  3. $nofwords = 1000;
  4. $fp = fopen($name, "w");
  5.  
  6. For($i=1; $i<=$nofwords; $i++){
  7.    $y = rand(3,6);
  8.    $st = "";
  9.    for($z=1; $z<=$y; $z++){
  10.       $x = rand(65,90);
  11.       $st = $st . chr($x);
  12.    }
  13.    fwrite($fp, "$stn");
  14.    print "$st<br>";
  15. }
  16.  
  17. fclose($fp);




Reply With Quote
  #4  
Old February 10th, 2003, 10:54 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
RE: RE: some questions


Quote:
- I assume by endofline you mean br tags, no?
- Do we have the opportunity to print more info than the basic? For example print the grid?


An endofline is simply a n escape character. Please no br tags. Also, please do not expand the output. I will be parsing it with a php script to automatically judge the scripts. If you vary from the output rules, I will be unable to parse your results.

Quote:
- Did you mean : by finding the sum of all 30 runs? if it is 10 then i dont get it.
- To my understanding you will create 30 different input files with each of them having anywhere form 500 to 5000 words. You will then test all those 30 files with every valid contest submission. Am i correct here?


Sorry, it should read 30 in all places. I will correct this.

Quote:
- Are you gonna check the results of each script? I mean someone could easily cheat and show a much higher than the actual scor. Maybe everyone should output the grid, so everyone could check if the results are valid.

Cheaters will be found out. If not by me, by someone examining their code after the contest. Because of this I am not too worried about cheaters.

Quote:
- If i submit my script and then improve it, can i send a second submission? Of course cancelling the first.

Yes you can. I would prefer that you hold your script and only submit once however. But, I will accept new submissions up until the deadline if need be.

Quote:
- Can you tell me if my script is valid to be in the contest if i submit the script?

No, I will not be checking scripts before judging. Please make sure your script follows the rules before sending it over. I simply don't have the time to test all submissions as they come in..

Quote:
Finally, here is some code to generate your own input files. I dont kno why some people have a problem figure this out, but anyway here it is :


Thanks!

Reply With Quote
  #5  
Old February 11th, 2003, 08:16 AM
fractalbit fractalbit is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 108 fractalbit User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Some more questions ...

2 quotes then a possible problem :

1. "You will receive the name of the input file via the URL ... Your script will be called like so:
http://server.com/some/number/of/dirs/scrabble.php?input=somefile.txt"

2. "Your script should run on PHP v4.3 with register_globals OFF."

Now the problem : I have installed php on my pc and when i turn the register_globals to off it cannot read the input variable from the url. I dont have any other global variables in the script and i am sure about this because when i hardcode the name of the input file into the script, it runs with no problems at all. Is this a problem with my php (v4.2) or else how are you gonna run the scripts passing them url variables???

Some more questions:
As i get it we will have to create an .html file with the content you say on the rules.
- Should we call the output file a certain name? for example output.html or scrabble.html?
-So can we show anything we want when running the script if the .html file contains only the neccesery content?

Reply With Quote
  #6  
Old February 11th, 2003, 10:59 AM
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
RE: Some more questions ...


Quote:
Now the problem : I have installed php on my pc and when i turn the register_globals to off it cannot read the input variable from the url. I dont have any other global variables in the script and i am sure about this because when i hardcode the name of the input file into the script, it runs with no problems at all. Is this a problem with my php (v4.2) or else how are you gonna run the scripts passing them url variables???


Please read up on how to write scripts with register globals off.

Quote:
As i get it we will have to create an .html file with the content you say on the rules.
- Should we call the output file a certain name? for example output.html or scrabble.html?
-So can we show anything we want when running the script if the .html file contains only the neccesery content?


The output from the script should be the html file going directly to the browser. No need to make another file.

Reply With Quote
  #7  
Old February 14th, 2003, 01:30 AM
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
RE: REGISTER GLOBALS IS EVIL

Buddy, friend, amigo.

When you use Register Globals (specifically, when you turn it on) it presents a security hazard if you have bad code. Register Globals, as you know, introduces ANY variable provided by the HTTP request into the global scape. I don't have the time to go into why this is such a bad thing, but trust me. It is.

If you're using PHP 4.*, you can grab any variable from the URL line with the array $_GET. For example: http://www.domain.com/script.php?rq1=5&dat=Hey
will result in the following for $_GET:
Array{
rq1 => 5
dat => Hey
}
So, then you can get the value of rq1 by using $_GET['rq1']. And when a user introduces a variable trying to maliciously control your script (such as "dat"), it is ignored because it's in $_GET and you don't need to grab $_GET['dat'].

As for the POST method with forms, it's $_POST. And (I'm not sure when you could start doing this) you can get ANY request variable with $_REQUEST.

Please SHUT REGISTER GLOBALS OFF. That is a disaster waiting to happen with some scripts.

Reply With Quote
  #8  
Old February 14th, 2003, 02:54 AM
fractalbit fractalbit is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 108 fractalbit User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: some questions

Thanks you very very much but i have already figured this out

The only difference, is that i use the $HTTP_GET_VARS table to register any url variables. For example :

$input = $HTTP_GET_VARS['input'];

Is this ok? And a final question : Can i use global variables inside functions with register_globals = off? I have already tried this with no problems but just to make sure since i have put a lot of effort in the algorithm of the script.

Reply With Quote
  #9  
Old February 14th, 2003, 02:57 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
RE: some questions

Two things:
HTTP_GET_VARS is depreciated. You should only use it if you can't use _GET.

HTTP_GET_VARS must be GLOBALed into a function
(e.g. function x (y,z){global $HTTP_GET_VARS; ... } ) to be used in a function. _GET, on the other hand, is what we call SuperGlobal, and it is available everywhere.

Good luck with this.

Reply With Quote
  #10  
Old February 15th, 2003, 02:44 AM
fractalbit fractalbit is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 108 fractalbit User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: some questions

I dont $_GET it! When i use the variable you say ($input = $_GET['input'];) i get the errors :
Warning: Undefined variable: _GET in DrogrammingCodeContestscrabble.php on line 27

Warning: file("") - No error in DrogrammingCodeContestscrabble.php on line 28

If i use
$input = $HTTP_GET_VARS['input'];
then no problem at all. Any ideas?

Reply With Quote
  #11  
Old February 15th, 2003, 07:19 AM
brut brut is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 367 brut User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: some questions

You're probably running a version of PHP prior to 4.1.0, which is when the superglobals were introduced. As such, you are doing it correctly. $HTTP_GET_VARS, $HTTP_POST_VARS, etc. will still work(for now) on newer versions.

Reply With Quote
  #12  
Old February 16th, 2003, 03:42 AM
fractalbit fractalbit is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 108 fractalbit User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: some questions

Thanks

Reply With Quote
  #13  
Old February 17th, 2003, 10:11 AM
gatopeich gatopeich is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Madrid, Spain / Boston, MA
Posts: 96 gatopeich User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 54 sec
Reputation Power: 2
Send a message via Yahoo to gatopeich
RE: RE: some questions

Hey, that code doesn't give a valid wordlist. There can be no repeated words. I asked Matt about it on another topic...

Quote:
Hi, i am new here...
php Code:
Original - php Code
  1.  
  2. $name = "input.txt";
  3. $nofwords = 1000;
  4. $fp = fopen($name, "w");
  5.  
  6. For($i=1; $i<=$nofwords; $i++){
  7.    $y = rand(3,6);
  8.    $st = "";
  9.    for($z=1; $z<=$y; $z++){
  10.       $x = rand(65,90);
  11.       $st = $st . chr($x);
  12.    }
  13.    fwrite($fp, "$stn");
  14.    print "$st<br>";
  15. }
  16.  
  17. fclose($fp);



Reply With Quote
  #14  
Old February 17th, 2003, 10:34 AM
fractalbit fractalbit is offline