Bracket Challenge
Want to set up your own 64 Team single elimination tournament and track the results? Everyone else does each March. It is madness. However, this ActionScript and PHP project will get you started. Download
- The source can be broken into five parts:
- Flash
- ActionScript
- Configuration
- PHP
- Admin
Flash 8
The bracket.fla just contains art/movieclips. The code lives in .as files. There is just a little bit of dependency on Kongregate.com -- the code waits until the name is set. Remove the initialization in the first frame.
ActionScript 2
The ActionScript is triggered by a call to include bracket.as in frame2 and by linkage to the Bracket* classes. BracketTree is a set of games. The BracketGame is a tournament game. BracketTeam has information about the team. Start by reading bracket.as and watching the initialization order.
Configuration
config.txt contains the paths to all the configuration files.
- saveurl - point to update.php
- loadurl - point to query.php
- top100url - points to top100.txt
- resultsurl - points to results.xml
- teamsurl - points to teams.xml
- scheduleurl - points to schedule.txt
- saveInterval - sets the save delay
- myname - if set, skips waiting for the Kongregate name
PHP
The PHP files that read/write from the database are in the server subdirectory. Start by setting the values in dbinfo.inc.php. query.php gets called when the SWF runs to get data for the user (or to create a new entry.) update.php gets called any time a save is requested.
Admin
Set the admin flag in bracket.as to create an admin client. This client will let you select teams after the tournament has started and will display the list of games/results on the score page. This will let you update results.xml. After updating results.xml, run "php admin/scoring.php %". This will update the scores in the database. You can use the mysql wildcard to do this in batches. After that is finished, update the top100.txt by running "php top100.php".
License (zlib)
Copyright (c) 2008 Robert Mitchell This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution.