PHP Programming Contests - April-May 2003 - No. 2

Please note this contest ended May 12th @ 23.59.

PHP Programming Contest
Contest A2 - (Cool Game)

This contest is intended for PHP Programmers with less that 6 months experience (or equivalent). You will be given a problem and it's your job to give your coded solution.

Contest Details:
You will be asked to script a cool game in PHP.
Yes, that's right a cool game. I thought this would make things real fun, so basically all you have to do is come up with a game, it can be invented by you or be taken from someone elses concept, but you must code it.

Closing Date:
All entries in by Monday 12th May 2003 at 23.59 (GMT)

Submissions:
Entries to: contest@php-editors.com before the closing date. Please include your username (from the forum) and contact details in a text file named contact.txt. Submissions should be zipped (contact.txt and script together).

Judging:
This contest will have several judges, judging will be based on things like Coolness, useablilty and gameplay and PHP Scripting.

Rules and Restrictions:
If using a database system, it must be either MySQL or Postgres -
- SQL to re-create an databases MUST be supplied.
Must run on Windows, and Unix systems
Must run with PHP4.2 (register globals off)
JavaScript is allowed (but the game must not be based on it)
Flash is allowed (but the game must not be based on it)
No PHP extensions (other that default builds)
Maximum execution time 60 seconds.
All code must be writen by you !
PHP must be the only Server Side Script used. (obviously)

Input:
Whatever you like (form, mouse, text files, command line, etc).

Output:
Whatever you like.

Prizes:



Contest A2 - Winner

This months 1st prize winner is: Jon Espen Karlsen
Click HERE for demo and code.

This months 2nd prize winner is: Barry A Andrew
Click HERE for demo and code.


Contest B2 - Mr. Rubik's

Contest Details:
The Rubik's Cube was invented by Enro Rubik in 1974. It's a 3-dimensional puzzle made up of 26 smaller cubes. Each smaller cube has from one to three sides exposed for a total of 54 exposed sides. Each of these sides is assigned one of six colors, and each color is assigned to precisely nine exposed sides. The cube is manipulated by rotating any side of the cube by 90 degrees. It is considered solved when each side of the Rubik's Cube is entirely covered by one of the six colors.

It's going to be your job to solve a mixed-up Rubik's Cube in the least number of moves. Your script will be given a text file with one mixed cube (on 5 seperate occasions) and output a list of operations needed to solve it.

Input
Text file called cube.txt (same directory as your script).

The input file will look like: Which follows this layout:
      G W O
      G R R
      G B R
B R B R G Y W W W Y G O
G W B O G B Y B O W Y O
W R Y O Y B R Y R G O O
      B R Y
      B O W
      G Y W 

Each character in this grid represents the color of the piece of the cube. There is one space between each character in the grid and possibly many spaces before the first character on a line. The grid represents the cube as is if it were unfolded and flattened out. Each group of 9 characters represents one side of the grid. The top of the cube is represented by the first 3 lines of input. The next 3 lines of input represent the left, front, right, and back sides in that order. The last 3 lines represent the bottom of the cube.

There are 12 possible operations that can be performed, each being a 90 degree rotation of one of the cube's 'faces' of 9 smaller cubes. Note that this results in the movement of 20 colored squares (8 on the face being rotated and 12 on the sides of the smaller cubes that make up that face). All 12 possible operations are listed in the table below with a description of how to perform that operation.

Operation Description
front left Performed by rotating the front side counter-clockwise when viewing from the front
front right Performed by rotating the front side clockwise when viewing from the front
left left Performed by rotating the left side counter-clockwise when viewing from the left
left right Performed by rotating the left side clockwise when viewing from the left
right left Performed by rotating the right side counter-clockwise when viewing from the right
right right Performed by rotating the right side clockwise when viewing from the right
back left Performed by rotating the back side counter-clockwise when viewing from the back
back right Performed by rotating the back side clockwise when viewing from the back
top left Performed by rotating the top side counter-clockwise when viewing from the top
top right Performed by rotating the top side clockwise when viewing from the top
bottom left Performed by rotating the bottom side counter-clockwise when viewing from the bottom
bottom right Performed by rotating the bottom side clockwise when viewing from the bottom
Sample Input

      O O O
      O O O
      O G W
W W W Y B G R B B G G G
B Y W Y B G R G G W W R
B Y Y B O O B W W Y Y R
      R Y Y
      B R R
      G R R

Sample Output
back left
top right
left right
right right
front left
bottom right
right left

Output
Each operation must be terminated by a \n new line (as above).

Closing Date:
All entries in by Monday 12th May 2003 at 23.59 (GMT)

Submissions:
Entries to: contest@php-editors.com before the closing date. Please include your username (from the forum) and contact details (including prefered language and platform) in a text file named contact.txt. Submissions should be zipped.

Judging:
This contest has several judges, scoring will use the following (in order).
Minimum number of moves to solve the puzzle.
In the event of more than one submission having the same score the fastest script will win.

Rules and Restrictions:
Must run on Windows, Unix Systems
Must run with PHP4.2 (register globals off)
No Client Scripts
No PHP extensions (other that default builds)
Maximum execution time 60 seconds (per cube)
All code must be writen by you !



Prizes:



Contest B2 - Winner

Unfortunatly all entries to this contest failed. The prizes have been passed to contest A2.




Important

*Important: First claim received picks between Zend and PHPed
*Important: First claim received picks between PHP|Arch and PHP Magazine



© Copyright 2003-2014 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.