Ibuildings Challenge The first challenge of 2011 is here! Most of you will be familiar with Four in a Line (you might also know it as Four in a Row, Connect Four or Find Four). In this game, two players take turns dropping their coloured discs from the top into a grid, trying to connect four of one's own discs (of the same colour) next to each other either vertically, horizontally or diagonally before the other player. Your mission Your mission is to build a virtual Four in a Line player. Feel free to practice against your colleagues or friends who are also participating in the challenge (or battle with your own implementation) to make your player perfect! Once we've received all the submissions (after 31st March), we'll play a little tournament: all of the virtual players will be played against each other, and the results will be collected in a league table. The winner, obviously, is the 'last man standing'. The rules * To be able to automate the testing of submitted scripts, you need to adhere to a specific format. Provide one php file containing your player implementation. * Your script will be run on a vanilla PHP 5.3 installation with default php.ini, no frameworks, no non-standard extensions. * Once you've entered the competition, you'll be able to download a tgz file which contains FourInALinePlayer base class, a very rudimentary example player, and an example of the grid that is passed as a parameter to the getMove method. * The name of the PHP class doesn't matter, but it must extend FourInALinePlayer and implement getMove and getName. * An example 5 x 4 grid is provided in the tgz file. When we run the players against each other, the grid size can vary between games. * If a player attempts to make any illegal move, they will automatically lose the match. Illegal moves are trying to insert a disc into a column that's full, or trying to insert a disc into a column that doesn't exist. * To keep things fair for everybody, we've created 3 categories based on your level of experience (0-2 years php experience, 2-4 years experience, 4+ years). * Entries must be submitted before 17:00 CET on 31st March 2011. Testing your submission Although we cannot give you too many instructions without making the competition too easy, we've built a small testapp that you can use for testing your virtual player. You have the following options: * Run 1 game between Player1 and Player2 on the default grid (7x6): php startConnectFour.php Player1.php Player2.php * Run 1 game between Player1 and Player2 on another grid (10x10): php startConnectFour.php Player1.php Player2.php 10 10 * Run 100 games between Player1 and Player2 on the 10x10 grid: php startConnectFour.php Player1.php Player2.php 10 10 100 The 'FourInALinePlayer' class in the Player-file is auto-detected, but must be the first class in the file. Download the test app (.zip file) http://fourinaline.phpgangsta.de/ibuildings/connectfourcontest.zip The winner To appoint a winner, we will play the players against each other in a qualification round. During this round, each player plays once against all other players in his/her own category (junior/medium/senior). Points are awarded in the following way: * 3 points for a win * 1 point for a tie * no points for a lose From the qualification rounds, the four best players in each category go on to the knock-out stage - a single elimination tournament (winner moves on to the next round). We'll randomly select who will be playing against whom. If we are unable to determine the players to go onto the next level by playing them against each other, we will additionally rate the players on the following basis: * Time is money, so 10 points go to the fastest app, 8 points to the second fastest, then 6 through 1 points for the next 6 fastest scripts. * Less is more, so 10 points go to the smallest app, 8 points to the second smallest, etc. (We won't count comments or empty lines so no need to skip them. We will count all files that you submit.) * Quality is important, so 10 points go to the app with the lowest CRAP index, 8 points to the second, and so on. Among the three category winners, we’ll randomly raffle an Apple iPad and two 2-day tickets to the Dutch PHP Conference. Enter the competition ** Please note that the competition is only open to applicants from the European Union, who are at least 18 years old at the time the competition closes. Read the competition rules to find out more.