Shocking Proof!

11:52.27 - Sunday 21st August 2005   (Link to This Entry)



Click for in-depth discussion and revelation.

More Lotto - Onto the user input!

20:11.20 - Sunday 21st August 2005   (Link to This Entry)


I've reached the point where I've got all of the account stuff so far working just fine, and users can change bits willy-nilly if they want to. I've actually moved onto the number handling part now, and the first page - letting the users enter numbers - was a doozy.

To start with I've had to find an efficient way to handle different numbers for different games. The Lotto draw expects users to pick six numbers, but the EuroMillions has them picking five plus two bonus (Lucky Star) numbers, and the database has to be able to handle this and any other potential combinations. As if that wasn't bad enough, the HotPicks game lets players pick 2, 3 or 4 numbers, and that needs to be handled as well.

I've divided the user lines up per game, since once a game is launched the requirements of what the player chooses doesn't change. HotPicks (grrrrr) is still the odd one out since we don't know how many numbers will be chosen, but the maximum of four never changes, and so that's what it's defined with. Each game has it's own table for drawn results, and it's own table of users' lines - all linked together by another table called 'games'.

The most difficult part of this page is that I have to create JavaScript on the fly. The JavaScript checks the numbers that the user has entered before submitting, and so this needs to be able to handle all of the weird and wonderful combinatons, too. That isn't the worst, though! Because JavaScript and PHP are freakily similar, it's a mind-twisting excercise in itself just to remember which parts are PHP and which are JS - Dreamweaver doesn't help much at this point because it can't tell what it's looking at, and so the PHP highlighting is non-existant.

You end up with crazy things such as:...which is nice!

Foo found a nice wee bug after I'd missed a +1 from somewhere, and the last number entered was throwing up duplicate number errors. That done, I gave up on coding for a while and settled back into Photoshop to tweak some graphical bits.

It's all good fun!