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:
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
  #1  
Old May 14th, 2002, 07:40 AM
EvilivE EvilivE is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Milwaukee, WI USA
Posts: 291 EvilivE User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via Yahoo to EvilivE
RE: The time draws near

I agree, it was fun. I think my other-half is glad its over.

Reply With Quote
  #2  
Old May 14th, 2002, 10:06 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: The time draws near

I cannot quite agree. It was clasiccal problem, sometimes formulated as finding the shortest path between two towns. This problem also has good solution, described in many books on algorithms

Reply With Quote
  #3  
Old May 14th, 2002, 11:01 AM
Laxersaz Laxersaz is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Neuss, NRW, Germany
Posts: 21 Laxersaz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to Laxersaz Send a message via AIM to Laxersaz
RE: The time draws near

I'm not quite sure if my solution works in every maze possible. I had much fun coding anyway and I'm really looking forward to the next challenge!

Reply With Quote
  #4  
Old May 14th, 2002, 05:34 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: The time draws near

I agree, this was a lot of fun. My only complaint is that there isn't a clear list of judging criteria. Sure, if you read through the entire forum, Matt gives some tidbits here and there, but there needs to be a good clearly defined list of goals, for example:

1. Function
2. Speed
3. Resource Usage
4. Code Length

That way, we know what we need to concentrate on first.

My Solution:
http://www.digitalsickness.com/contest/

Let me know what you guys think...

Reply With Quote
  #5  
Old May 14th, 2002, 06:08 PM
zodiak zodiak is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Portugal
Posts: 4 zodiak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: The time draws near

yeah, very good.

Reply With Quote
  #6  
Old May 14th, 2002, 06:15 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: The time draws near

very good work

what cpu(s) does the server have?

my solution
http://www.s0nix.de/path.php
(running on a dual PIII 500MhZ)

Reply With Quote
  #7  
Old May 14th, 2002, 06:49 PM
diclophis diclophis is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Tampa. FL, USA
Posts: 35 diclophis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via ICQ to diclophis Send a message via AIM to diclophis Send a message via Yahoo to diclophis
The time draws near

This proved to be a rather interesting challenge. I am allready looking forward to the next one. I know i learned alot about the upper limits of PHP and some techniques to optimize every cpu cycle in my scripts. who woulda thought a maze could be such a complex thing, both mathmaticly and in terms of code. I am looking forward to seeing the results on this one.

-Jon

p.s.

Here is mine: http://sig.mine.nu/maze/

Reply With Quote
  #8  
Old May 14th, 2002, 06:51 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: The time draws near

heartily agree, this was a pleasant distraction. nice puzzle, matt, look forward to the next one!

Reply With Quote
  #9  
Old May 14th, 2002, 07:27 PM
jameadows jameadows is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Ashland, OR US
Posts: 7 jameadows User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: The time draws near

Me too, me too! This was a great fun diversion and a good challenge to push my fledgling PHP chops.

The only problem is I've been writing so much PHP lately that when I get back to my day job writing C++ code I keep putting the dang $ in front of my variables!

Thanks Matt. I'm looking forward to the next one

Reply With Quote
  #10  
Old May 14th, 2002, 09:54 PM
johndoe110479 johndoe110479 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Bucharest, Romania
Posts: 9 johndoe110479 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to johndoe110479 Send a message via AIM to johndoe110479 Send a message via Yahoo to johndoe110479
RE: The time draws near

Thumbs up for all the coders who solved the problem...

Most of all, thumbs up for Matt: the man who came up with the idea of this contest. I really hope this contest will not dissapear.

Best wishes for all PHP coders!

Reply With Quote
  #11  
Old May 15th, 2002, 07:43 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: The time draws near

Now that the deadline's passed, I'd love to see some of your code -- especially those of you who managed to solve the 201x201 map in under 1 second...

I'll start:
http://www.0wn.org/contest/maze/maze.phps

Matt, if you'd rather us not share, just let me know and I'll edit my post.

Thanks,
Chris Lambert, chris.lambert@vbulletin.com

Reply With Quote
  #12  
Old May 15th, 2002, 08:19 AM
EvilivE EvilivE is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Milwaukee, WI USA
Posts: 291 EvilivE User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via Yahoo to EvilivE
RE: The time draws near

I ran this code against a 200x200 maze and it solved it in somewhere between .65 and .70 seconds. This is the "work horse" of the code. If you care to see the rest of it go here.

php Code:
Original - php Code
  1.  
  2.   // fill the 2d array
  3.  
  4.   while (!feof($fp)){
  5.     $ch = fgetc($fp);
  6.     if (!feof($fp)){
  7.       if ($ch == "W"){
  8.         $maze[$row][$col] = $ch;
  9.         $col++;
  10.       } else if ($ch == " "){
  11.         $maze[$row][$col] = -1;
  12.         $col++;
  13.       } else if ($ch == "n"){
  14.         $row++;
  15.         $col = 0;
  16.       } else if ($ch == "S" || $ch == "E"){
  17.         $maze[$row][$col] = $ch;
  18.         if ($ch == "S"){
  19.           $s_row = $row;
  20.           $s_col = $col;
  21.         } else {
  22.           $e_row = $row;
  23.           $e_col = $col;
  24.         }
  25.         $col++;
  26.       }
  27.     }
  28.   }
  29.   fclose($fp);
  30.  
  31.   // define boundries
  32.   $b_right  = sizeof($maze[0]);
  33.   $b_bottom = sizeof($maze);
  34.  
  35.   // start algorithm from 'E'. this will mark only one 'space' and record
  36.   // its coordinates, which 'space' is determined by which side 'E' is
  37.   // located. No need to check for 'E' in a corner.
  38.  
  39.   if ($e_col == sizeof($maze[0]) - 1){
  40.     $maze[$e_row][$e_col - 1] = $c_count;
  41.     $c_count++;
  42.     $tmp_row = array($e_row);
  43.     $tmp_col = array($e_col - 1);
  44.   } else if ($e_col == 0){
  45.     $maze[$e_row][$e_col + 1] = $c_count;
  46.     $c_count++;
  47.     $tmp_row = array($e_row);
  48.     $tmp_col = array($e_col + 1);
  49.   } else if ($e_row == sizeof($maze) - 1){
  50.     $maze[$e_row - 1][$e_col] = $c_count;
  51.     $c_count++;
  52.     $tmp_row = array($e_row - 1);
  53.     $tmp_col = array($e_col);
  54.   } else {
  55.     $maze[$e_row + 1][$e_col] = $c_count;
  56.     $c_count++;
  57.     $tmp_row = array($e_row + 1);
  58.     $tmp_col = array($e_col);
  59.   }
  60.  
  61.   // goto the coordinate(s) that have been marked and mark its adjacent
  62.   // 'spaces' if applicable (check for -1).
  63.  
  64.   while (sizeof($tmp_row) != 0){
  65.     $orig_size = sizeof($tmp_row);
  66.     for ($i = 0; $i < $orig_size; $i++){
  67.       // ckeck up
  68.       if ($tmp_row[0] - 1 > 0){