The Betfair Quiz application used Flash and PHP to create a quiz related to the World Series of Poker Championship. In the game, the user is presented with a number of questions and five playing cards to choose from. If the user answers the question correctly, they can choose a card to add to their ‘hand’, if they get the answer wrong, a random card is chosen instead.
After the user collects five cards, they receive a score based on their poker hand. The score is entered into the application’s leaderboard. The aim of the application was to be the player on top of the leaderboard. The leaderboard was split into three sizes: the users friends, the user’s Facebook network, and all application users.
For this application I coded the entire application except for the Flash component used in the actual game. I created a API for use in the backend to handle the communication between the Flash game and the databases. The API was used to pass the user’s high score back to the server so it could be stored on the leaderboard. The questions were passed into the application using XML so they could easily be updated.
One of the challenges with this application was optimizing the SQL query used to generate the leaderboard. During testing we found that the query used to be slow when the user’s friends list or network was quite large. To overcome the issue we used the Facebook API to return only friends who had installed the application, and then use this sub-list in the SQL query.