The inner programming thoughts of the creator of

Monday, October 23, 2006

Site Subscriptions

I recently anounced on the site's forums that I plan to introduce a large number of new features which would be available to players who pay a subscription fee. The cost of a subscription would be £10 per year and for that they would get full access to all subscription features.

The list of new features was quite extensive, and in general everyone was very supportive of the idea saying that they would be wel worth paying for. Unfortunately there does seem to be the odd one or two rather vocal members who are against the subscription idea, and they tend to have a few arguments as to why I shouldn't do this. Here are those arguments and my replies: has always been free and should always remain free.
In an ideal world without money this would be true, but we do have money and the website costs me an increasing amount. Currently I pay aound £50 per month to keep the site going - that's £600 a year. But, the server package we're on is reaching the limit of what it can efficiently cope with and if there is much more growth in the site it will become pretty much unusable for everyone. I estimate that within 6 months this critical point will occur and then what - do I pay out of my own pocket for a considerably more expensive package?

I've talked to my webhosts about the future of the site and together we've come up with the sort of package that will be needed to keep running smoothly for the next couple of years, and it's going to cost me £120 per month, plus advertising costs to keep new members coming, so all in all that is approaching £150 per month, or £1800 per year. Who would want to pay that much to play on a chess site? I can't afford it, so unless I start making money from the site we'll all start to suffer from slower performance as time goes on.

By charging a subscription it will no longer be a free site and people won't want to join.

No one will be forced to pay anything. If a player doesn't subscribe then that's fair enough, they don't subscribe. They will get the same features that they get now and it will be free for them. By subscribing you get extra features, but by not subscribing you lose nothing, so you can still play free chess on the site.

Why don't you just have advertisements on the site to pay for your costs?
Some chess sites do both - they have advertisements that are removed if you pay a subscription. Advertisements work best when you have a large volume of unique visitors on a site each day, but we have pretty much the same visitors each day. Once a person has seen an ad they will ignore it for ever more. Ads on our site will be totally inneffective, distracting and ugly, and I'm convinced that they are not the way to go. They will be a downgrade of the service that everyone currently gets and I'm not willing to do that.

You just want to make a profit.
Yes and no. My main concern at the moment is in paying for the site's cost. Any profit that is made will go straight back into the site in the form of more advertising hence getting more people to join. In the long term (i.e. a year or more from now) it would be great if looking after the site became my fulltime job, but do we consider that profit? I have no interest in becoming a chess millionnaire, I'd simply want to be able to turn my hoby into my job and be able to look after the kids during the day while the missus goes to work (modern family, ey? [we don't have any kids yet, but who knows what will happen in a year or two]). Anyway, I digress - all proceeds will in one way or another be spent on the site to make it better for everyone.

I hope that this explains my decision to implement subscriptions. It's not as if I've just spontaneously decided to do it; a lot of thought and discussion has gone into it and I'm convinced that it will result in a better site for everyone.

Thursday, August 31, 2006

Draw By Repetition

A couple of weeks ago a member of the site known as "Student" pointed out to me that he had a game where the same position was repeated 3 times but it wasn't a forced as a draw. I wasn't surprised by this because there's no code in the site to cater for this situation, but I've known about the shortcoming since the site started but chose to disregard it for the time being. It wasn't through neglect that I'd ignored this, but due to something fundamentally very difficult with the site's current setup.

Consider any given chess position - there are many dfferent combinations of legal moves which can lead to that position. When a player currently makes a move the site stores the coordinates of that move, as well as other things such as the availability of an enpassant capture on the opponent's next move, if the player castled, and so on. Now, if we need to work out if a given move leads to a position that previously occurred then the site needs to look at every move so far and work out what the position was after that move was made, and then compare that with the current position. We'd keep a track of how many times the current position had occurred before and then act appropriately once the move was made.

This is all very complicated and not very efficient.

Now that Student had asked for this feature to be incorporated into the site I could no longer overlook it, but I was not willing to implement the procedure I just described. Something new was needed, something that could match board positions quickly and efficiently.

The solution was to store the entire board position on the same database record for the move that created it. this might strike you as being a bit obvious, and I had pondered this for a long while but was put off because of the size of the data structure needed to store a chess board. Multiplied by half a million moves this would be an enormous amount of data. I managed to use a clever solution to this that I read about somewhere 6 months ago when I was learning about chess AIs. If we store an encrypted, compressed version of the board then the volume of data can be dramatically reduced. I say encrypted because then it can be made smaller, and for reasons I'll explain later we don't need to worry about decrypting it.

To encrypt a board position I first create a series of binary 64 character strings, with one string for white pawns, one for black pawns, white knights, black knights, and so on. When building one of these strings, I examine every square and if there is a piece I'm interested in on the nth square then the nth character in the string is set to 1, otherwise it is set to 0. In all we end up with 12 strings, which are then concatenated to make one big 768 byte string. Now for the clever part - I use the encryption functions MD5 and SHA1 to provide two encrypted versions of this string, 32 and 40 bytes long resectively. These functions are non-reversible, but the same input string will always give the same output string. The chances of two different input strings giving the same output are extremely low. In fact, you are more likely to win the lottery every week for the rest of your life than you are to randomly find two input strings with the same encrypted output on both the MD5 AND SHA1 encryptions.

So, when a move is made we store the encrypted board position, and now we can look at all other move records in the game and see which ones had the same encryption values. Same values = same position. That's why we don't need to be able to reverse the encryption because we only ever compare the encrypted positions, and there's no need to have to extrapolate what that position actually was.

However, there was still a big problem. In the moves database there were 450000 moves that never had any encrypted positions stored on them, and for this to work properly they had to. I wrote a script which looked at all of the moves in a game and worked out the encrypted positions and stored them against that move record. The script took an hour and a half to run, but early tests show that it worked!

Now all I need to do is work out the actual chess rules for forcing a draw, but that's not going to be easy - there is a debate raging on the forums as I type!

More to come...

Friday, August 18, 2006

A Chess Intelligence

Over the last few weeks I have been planning what could become an awesome new feature. I want to write an online chess AI which players could challenge and play against on my site. The AI would have a rating like everyone else and this rating would increase or decrease as it wins or loses games. Obviously it would be imperative that everyone knew that this player was an AI, and the ban on players using an AI to assist their own games would still stand.

Q: So why do I want to do this?
A: For the challenge of it, and for the boost it could give the site. Writing a chess AI is very challenging (believe me, I've done it before with limited success) but the rewards make it worth while when you see it come up with a move far better than one you could have come with. I've never been beaten by one of my own chess AIs before, but the as I get better at writing them then that milestone will come.

Watch this space in the future... :)

Sortable Tables

Information is such a useful thing, but all to often in the web world you are left at the mercy of whoever publishes it and have to view it in their ored. Allow me to explain... In any computer program if you were presented with a grid of data you would expect to be able to easily sort it by column A, or column B, or whatever column you saw fit. However, people don't seem to expect the same from a grid of data in a web page, and the only reason is because developers just don't do it.

I decided to break this mold and have started to make the data presented on the site sortable - in REAL TIME! I don't mean click your sort options and then refresh the page, I actually mean immediately after you click the data is reordered, without any page reloads.

Here's how I did it.

I have written a table class for the PHP scripts, and to this clsss I pass an array of data rows. Each data row is itself an array of cells, and each cell has various properties such as value and sort value (more on tat later). Now, when calling the table's drawing function the class will create a javascript representation of the table's data, and will then draw the table using DIV elements.

When a column is clicked a javascript function is invoked which looks through the array that represents this table and works out which order the rows should be in. It then swaps the contents of row 1 with row 5, row 2 with row 8, and so on until the table is sorted by the column you clicked. It also stores a flag denoting what order each column in currently in (ascending or descending) so that the next time you click that column it is sorted in the opposite order.

Remember I mentioned the sortvalue? Consider the fact that the date "11 Jul 2006" is after "22 May 2006", but "11 Jul 2006" is alphabetically before "22 May 2006". By using a sortvalue the javascript can see the dates as a number (or whatever I tell it) and so can sort dates in true date order rather than how they alphabetically appear. The same would be true for images, or whatever else I decide to put in the tables.

The results are tables that look just like they always did, but are sortable.

These tables are only in a few places on the site at the moment, but I am slowly converting them all to have this functionality. As an example, check out the screen shots below to see the same data from the Games Lobby page sorted by different columns.

Sorted by date:

Sorted by moves:

Sorted by username:

5 Month Update!

It's one of those sleepless nights again and suddenly I remembered that I haven't made a blog posting in a long time, in fact for over 5 months! It's not that I forgot about, on the contrary I have been extremely busy with the site. I simply never got around to blogging about what I've been up to lately with it. I'm now left with the task of bringing you, my loyal reader(s) up to date with everything that's been going on. I won't do it all in one post, but will make several posts over the next few days to get everything up to date.

Let the good times roll...

Friday, April 07, 2006

Live Current Games List

The side menu that lists your current games is now 'Live' in the sense that it will appear in your list within 10 seconds of a player moving in it. There are some limitations at the moment, for example it won't show you games where you can promt, have a message, or the game has ended - you'll have to wait until a full page refresh for that. I will get these limitation sorted once I've come up with a really good, stable and consistent way of doing all of this Ajax stuff.

In my previous post I talked about the XML file format for an updated game. Well, here's some text data from my own computer that the server sent when asking for games to add to the side menu:

<games_list_games lastupdate="1144442712">
  <game game_id="159" curplayer_id="2" status="CURRENT" clockticking="1" tournament_id="0">
    <player1 user_id="2" username="Woof"/>
    <player2 user_id="7" username="SteRobson"/>
  <game game_id="199" curplayer_id="2" status="CURRENT" clockticking="1" tournament_id="17">
    <player1 user_id="7" username="SteRobson"/>
    <player2 user_id="2" username="Woof"/>
  <game game_id="4001" curplayer_id="2" status="CURRENT" clockticking="1"   tournament_id="0">
    <player1 user_id="7"   username="SteRobson"/>
    <player2 user_id="2" username="Woof"/>

Pretty cool, huh?

The Fox Trips Over

No, I'm not talking in some strange cryptic speak, but I'm actually referring to Firefox and in particular 1.0.7. Firefox is my web browser of choice because it looks good, has some fantastic extensions, and does a decent job of rendering pages (but not the best though - Opera has that honour in my opinion). So where does good old Firefox trip over? Let me explain something about the site to you and then you'll start to understand...

The new live chess feature polls the server every 5 seconds to say "Hey server, has my opponent moved yet in game 1234?" The server then says either: "Nope, still nothing" or "Yep, they have indeed". (obviously these communications are not really in readable English, they are just short numbers). In the case of the first event the user's browser thinks "Oh well, I'll set a timer so that I can try again in 5 seconds" and that's the end of the story. However, if the server tells the browser that the opponent has moved then exciting things start to happen. The browser will immediately send a message to the server saying "Ok server, tell me everything about the last move made in game 1234" and the server replies saying "Ok, here it is." and then gives the browser a piece of XML tag something like:

<updated_game game_id="1234" lastmoved="11354214">
<move x1="1" y1="7" x2="1" y2="5" captured="0" castled="0" check="0">

The browser then works through this XML and from the current board position can work out what pieces to move and stuff. Simple, right? No! For some reason Firefox 1.0.7 just cannot properly send the second request immediately after receiving the first one. Version 1.5.1 can, even Internet Explorer can, but this version of Firefox just refuses to ever return a result.

Why? I don't know.
The solution? To rewrite the code so it can somehow do it all in one request, maybe the server returns the whole XML if the game has changed, otherwise nothing if it hasn't.
The result? For the first time ever Firefox is not playing nice (for me).


The Big Three 0's

Soon we'll reach 1000 members. This is a fantastic milestone and I'm thrilled to bits that's we've almost got there. This time last year I was thinking that if we can get 100 members then that would be really cool, I certainly didn't expect 1000 within a year. So what's the next target after that? 10000 games won't be that far off (probably about 6 months from now), half a million moves by the end of 2006, and we should get to 2000 members before the end of the year.

The annoying thing is, unless we have a massive surge of newbies joining today, I'll be on holiday when the 1000th person signs up so won't get to see it :( Maybe I should cancel the holiday in honour of this event...? Nah, the Missus would kill me!

Thursday, April 06, 2006

Divvy Tables

The more web savvy of you will be rolloing around in laughter at the thought of a divvy table because the two are completely different ways of implementing the same thing. Let me explain:

A table is just that. You define rows and columns and what goes in the columns, and then the web broswer does the rest.

A div is a containing rectangle in HTML. Pretty boring, except that you can put whatever you want inside the div and then position the div (and hence its contents) wherever you want on the page (or in another div even).

Divs are much more flexible than tables, render more consistently in all browsers than tables do, and are a much neater way to write your code. The problem is, was written using tables for pretty much everything because, at the time, I didn't know any better. Now I'm paying the price for that because of all of this real time fun that I'm writing. Here's the problem:

I want to make the list of currently active games in the side menu dynamic, so when someone moves against you in a game that you're not viewing you still find out about it immediately. Unfortunately the menus are all written as tables which makes using Javascript to update them a failry complicated task. I'm now rewriting this menu using DIVs, and using Javascript to create one of them is as easy as pie. In fact, I've got it all working on my home tests now. Except for the bit that actually reads the new game information of course... Heh heh, can't have everything I guess.

Tuesday, April 04, 2006

So This Is Realtime

I've been trying to get organised lately and prioritise all of the great suggestions that people give me for the site. Unfortunately I'm not very good at that sort of thing, but the missus is so she's now my 'boss'. Ruthie collects all suggestions and makes them into a list and she decides what the priorities should be. I then go ahead and write what she tells me :) The results of this have been quite fruitful, and here I'll tell you about them.

On Vacation
Players can now set their status to 'On Vacation' using the 'My Preferences' page. This will remove them from the list of available players to invite to new games, it will state in their profile that they're on vacation, and also in any of their games. Of course, we don't want players to forget that they've given themselve this setting so when a player who's defined as on vacation logs in they will see a reminder at the top of each page telling them as such. It works well and I'm planning on using it when I go away :)

Invite your Friends
There's now a feature to let a player send out an email to their friends asking them to join the website. The email can have an additional personal message on it and tells the recipient who has invited them and how they can join. In the future I'll probably make the ability to automatically start a game with the recipient once they sign up, but that's a fair way off yet.

Forum Thread Order
You can now view forum threads in order of most recent post across all forums. This means that to see recent posts you only have to look in one place rather than check across multiple forums. This will make it easier for the few active members in the forums to keep being active and hopefully will encourage others to join in.

The Best Bit is now capable of REAL TIME CHESS. That's right, if you and your opponent are viewing the game at the same time then you will see the move just seconds after they make it. Best of all it uses Javascript to move only the pieces that have changed rather than refreshing the entire page so not only is it a lot faster, but there'll be a significant bandwidth saving on my server.

There system isn't perfect yet. For example, it doesn't update any of the side windows such as game chat, captured pieces, opponent's move, notes or matching games. It simply moves the pieces oon the board, but all of these missing features will be coming. There's also a problem in some versions of Firefox where for some reason it just doesn't work. I don't know why yet, especially since I developped it with Firefox as the main test browser. Eventually the lists of current games, active users, site statistics and, well, everything will be updated as and when needed. It's a very exciting time for the site so stay tuned! Who knows, one day I'll probably even post an in depth description of how this actually works. I bet you can't wait ;)

Friday, March 17, 2006

Wallowing in Misery At Home, Much To Your Benefit

Last Friday I got home from work feeling triumphant in the fact that it was now the weekend. My triumph turned into defeat when that evening I got a cold. On Monday I went to work anyway and fought through it and felt mighty pleased with myself that my 100% attendance record was still in tact. On Tuesday morning I woke up unable to speak. My throat felt like I'd swallowed a cactus, my nose was stuffy and I felt sick. Oh dear, time to have a sick day. I was also off on Wednesday and Thursday and spent the days at home, shivvering and feeling mighty sorry for myself. The only benefactor of this illness was Plaggy Bishoire and it's members since I had a lot of uninterrupted time to work on it. Here's what I did:

Getting it Organised
The tournament lobby page has been getting bigger since it was first written with new features added as the need arose. I figured it was time to add even more features but this time without clogging things up even more. The first step was to create a contents list at the top of the page enabling quick navigation. This was simple enough, except that you need a different list depending on whether you're in the tournament or not, and if it's currently running, waiting to start or ended. I got there in the end and the result is a very simple yet usable menu.

Highlight of the Tournament
The next task was to make it easier to see how people are doing in tournaments. Ok, so we have the league table which is great, but it's hard work to see what games someone is playing in a tournament because you have to first find their seat number and then cross reference that with the (often very large) games grid. Surely there's a better way? Yes there is. Now each player has a "Show" link next to their row in the league table and clicking this will highlight data in the tournament that's relevent to the selected player. Every list in the tournament lobby is highlighted in this way making things much simpler. You also get a simple list of al of the highlighted player's current games and their results.

Chat To your heart's Content
All players in a tournament can now have a discussion amongst themselves. Only the people in tournament can see the chat so this will be great for idle banter and the odd bit of (good natured) gloating.

Points, Points and More Points
Tournaments are fun aren't they! you get 3 points for a win, 1 for a draw and 0 for a loss. Splendid, simple and easy. Now the tournament creator can specify a custom scoring system to match their sadistic desires. For example, you could get 1 point for a win, 0 for a draw and -3 for a loss, or pretty much anything they like (within reason and within certain rules). The scoring information is available on each tournament's lobby page so you should check this before joining.

It's a Tie!
I've talked at length about how the league results are organised when two or more players have the same number of points. Unfortunately there was a tournament where the top two players had identical points, wins, losses and draws, so the gold was awarded based on their username. This clearly isn't fair so now the system is even cleverer and in these situations will award 2 golds and a bronze. It works for all positions (not just the top 3) and has no limit on the number of players who can share a position. Obviously the person who unfortunately got silver in the past tournament has now had it swapped for gold!

Player's World Ranking
Well, not quite the world ranking, but in a player's profile you will see their site ranking. This isn't the rating, here the person with the top rating will have a rank of 1, and so on. The rank calculation excludes anyone with less than 5 completed rated games and players who've been inactive for 4 weeks or more. I think it's a very good, very fair way of charting your position relative to everyone else. The best part (by some standards) is when you click the ranking in the profile - it opens up the list of members and highlights that player! Wonderful!

Tournament List
In a player's profile there's now a list which shows all of the tournament that they are currently playing in. You can click any of these tournaments to be taken to its lobby where that player is automatically highllighted for you. See how everything comes together?

Games Lobby Enhancements
The "Your Current Games" list in the Games Lobby now highlights all games where your opponent is currently online. This should help you prioritise which moves to make first when times are busy.

Unfortunately I'm now healthy again so that's it for updatesm, until the weekend of course. Oh, that starts in 5 hours. Excellent!

Friday, March 03, 2006

So What's New?

As a lot of people will probably now know, the site goes through ups and downs when it comes to new developments. Currently we're in a bit of a down spot because there's not that much that needs urgently doing. If I wanted to I could dream up lots of new features and go ahead and write them, but over these last few weeks I've been content to sit back and watch the website run itself. It's not been completely quiet though, so 'll tell you about a few new features that I've made.

Welcome Email
When they sign up, new members will now be emailed with a pleasent welcoming message. The email is also functional as it confirms their name, password, and also tells them how to change their preferences for common things so that they can get up and running as quickly as possible. Of course, when they sign up they can opt to not receive such an email, because we don't want to be found guilty of spamming people do we? There was an ulterior motive behind this email though... retention of more members! It's a sad truth of most websites that the majority of people who sign up don't actually come back. Unfortunately I pay for every person who joins, so it's in my best interests for everyone to be active, otherwise what's the point. This welcome email will help towards that goal. While we're on the subject of keeping people...

We Miss You!
When a member has been inactive for 28 days they will now be sent an email reminding them that they have an account with us and that they are always welcome to come back and play. It's too early to tell if this is having an effect yet, but in principal it's a good idea.

Faulty Games
You may remember that occassionally there would be a game where the player just couldn't move, even though there were in fact plenty of legal moves available. I think I fixed this problem (it's a VERY slippery beast so it's hard to tell) but there's now an automated task which checks all active games every hour to see if they are corrupt or not. If it finds any corrupt games then it emails me the details so I can look at it and fixed it. So far it has picked 1 up, and that was before I made the fix, and since then there haven't been any. That's god news!

Blue is the Colour
I've made a little style change to the site and now all input controls turn a pleasent shade of blue when they have the focus. It's a nice touch that makes navigating the forms a little bit easier. Unfortunately browsers have a nasty habit of caching style sheets so if you don't see this change then pressing CTRL+F5 (or equivellent) should force it to reload the style sheet and you'll be fine for ever more (I really must come up with a solution for this achning problem).

Passworded Tournaments
There have been a few tournaments now which are not intended for puplic use but are instead for a group of friends to play. These are fine and undoubtedly even more fun than a standard "prove you're better than this bunch of strangers" tournament because you'll get away with a lot more gloating. However, no matter how clearly you state in the tournament's title and description "by invitation only", uninvited people still join. This must be a language problem, but it is still a problem. To get round this there is now an option to create a new tournament with a password attached to it. Anyone who wants to join the tournament must enter this password first and then they can join. The tournament's creator can then remove the password at any time, effectively opening it up to the public as normal. The end result is that if someone creates a private tournament, then unless they tell you the password you can't join. Simple. Fool Proof. Yeah, right, never underestimate fools. Time will tell.

Extended Tournaments
I've had to extend the running time of a couple of tournaments. Contrary to popular belief by some trouble stirrers (you know who you are...) I didn't do this to increase my chances of getting a trophy. In fact, if anything it has decreased my chances because now my nearest rival (good old HISSING SID) will be able to complete all of his games and open up a significant gap from me. The reason I did this was because when the tournaments were created we didn't know how much time would be appropriate. It turns out that 60 days is not long enough for a 16 player tournament so I put an extra 15 das on it. Had the tournament gone stale and there were no active games anymore then fine, I wouldn't have bothered, but there were still a lot of people playing so it felt wrong to just cut them all off. Of course, new tournaments have a better calculated minimum time so if anyone overruns in them then it's just tough luck I suppose. Sorry.

Excuses, Excuses
So, why have I done so little recently? The honest answer is I've been writing something else! PlasticBishop has taken up all of my programming time over the last year, but now that it can look after itself (mostly) I thought I'd get started on something that I've wanted to do for a long time now. That's right, I'm writing my own backup software. Sound dull? If so then try spending several weeks studying legal move permutations and how to programmatically verify them, and then a backup program will seem like a breath of fresh air.

Don't worry though, Plaggy Bishop is still my main concern and it is by no means finished. I've got an ever increasing list of new features to write into it and I'm determined that I will make them all (or at least have a very good reason why I shouldn't). Details will follow at the appropriate times.

Monday, February 13, 2006

Even More Tournament Updates

Yesterday I had another good day and implemented some more tournament features to make them a little easier to manage.

Backing Out
Before a tournament starts, players now have the opportunity to withdraw from it. I'll be honest, I was prompted to write this code because I was an idiot and accidentally joined a tournament I didn't want to, not to mention the fact that Ruthie had been nagging for such a feature for quite some time. It makes sense and I think will be used quite a lot, so the result will be tournaments being populated by people who really want to be in them, not those who enthusiastically joined but then regretted it.

Disqualified Myself
I had an error. When trying to disqualify a non moving player, the code actually disqualified me from the tournanment instead! I quickly found the coding error
and fixed it, but that didn't help my current situation. I ended up sifting through the previous day's backup for all records that linked my games to that tournament and then reinserting them. It took ages, but that's what I get for being stupid :(

Games Lobby Open Tournaments
I made a couple of changes to the Games Lobby tables, the first of which was in the list of available tournaments. You can now see how many seats are still available in that tournament, and also you will get a Javascript confirmation box when you attempt to join the tournament. This was another measure to prevent me from accidentally joining other tournaments again, and I'm sure other people will find it useful too.

Current Tournaments
The Games Lobby list of a player's current tournaments now shows the percent complete for each tournament in the form of a little graph. It looks great and lets you get a quick glimpse of the state of each tournament.

Invited Games
The Invited Games list in the Games Lobby used to just say "Tournament" in the cancel option, but didn't give any indication as to which tournament the game was for. Now that text is actually a hyperlink to the tournament, making it simple to tell.

Tournament Grid
The tournament league grid which displays the status and result of all of a tournament's games got a bit of a makeover with the new icon for a disqualified player. However, I didn't want to stop there, so Ruthie made a few more little icons to make the different bits of information stand out more. Here's a screenshot of it, I hope you agree that it's certainly very eye catching.

I've got more stuff like this planned, but the challenge is getting it all to fit in. Next weekend is a four day weekend for me, so maybe there'll be a lot more to report on. Here's hoping!

Sunday, February 12, 2006

Much to Report On

Greetings! I haven't written in here for a while because, well, nothing was happening. I didn't have any particularly exciting projects going on, and all I did each day was make my moves and not a lot else. However, on Friday everything kicked off and now there's some great new features to discus.

Site Down Time
Friday saw the site experience some pretty severe down down time, kind of. The site was operational but useful features such as the handy games list in the side menu were totally dead. Before you start to blame me, this wasn't anything I'd done. Our webhosts had been making changes to all of their big server accounts (which we're on) but Plaggy Bishop did not respond well. Their changes disabled a lot of database features that we use, and this caused all sorts of permission conflicts and the likes. Oh dear. They got it back up and running though, and they were extremely apologetic. As a result they have given me a rebate of some money, have restructured their internal communication systems and have built a new emergency paging system so I (and other people) can directly contact them at any time of the day or night. Nice to know that the site has done something :) (Note: They may have already been in the process of all these communication changes anyway, but I like to think it's really because of us.)

View All Tournaments
Since tournaments began a couple of months ago (wow, that long?) one of the most common requests has been for a way to monitor the progress of all tournaments, especially the ones that a player's not involved in. It's a simple enough request. Afterall, any player can view a tournament's lobby even if they're not involved in it by simply putting the right ID value in the URL. The problem was, where do I put this list of tournaments? It can't go in the Games Lobby page because it would take up too much space, and that's supposed to only be for games you're involved in.

On Friday night (or very early Saturday morning, I can't remember) it hit me. Just have a separate page for the tournament lists. So, that's what I did. From the Games Lobby or any Tournament Lobby page there's now a link to "View All Tournaments" which takes you to this list. Here is the list:

As you can see, there are 2 lists, one for current tournaments and one for completed tournaments. The best part are those little graphs that tell you how far along the tournament is. I think they're extremely effective and look great. I chose not to display unstarted tournaments because not everyone is able to join every tournament, and it might create some ill will if people want to join a tournament that they're not eligible to.

Another wonderful feature on this page is a graph of tournament seat availabilities. It shows two things. 1 - how many tournament seats are currently available to each rating band, 2 - how many tournament seats are filled by each rating band. Here's the screenshot of it:

I think it looks great!

New Tournament Rules
In tournaments people can now be disqualified if they don't play their games. This will speed up those tournaments where some players just can't be bothered to play. Disqualifying them will remove all of their points for that tournament and also the points that other players may have picked up off them. Your existing games with them can still continue, but they are no longer tournament games.

Disqualifications got me thinking about the tournament league tables. Obviously a person who's been disqualified so has 0 points needs to be ranked below the person who's tried their hardes in 10 games but lost them all so has 0 points. My cunning league sorting routine that I made a month or so ago can handle this very nicely. However, another tweak was required. Consider this situation:

Player A plays 10 games but loses them all so has 0 points.
Player B hasn't played any games yet so has 0 points.
Technically player B has played fewer games for the same points so should be higher than player A. However, common sense dictates that player A should be higher because at least they're playing. Ah, the old problem of computers and common sense. Another quick modification to the sorting routine and now players with 0 completed tournament games are given a lower position than those with some games, even though they all have the same rating.

Another change to thge tournaments will be noticed when a tournament's allotted time expires but all games aren't finished. Now, if 50% or more of the games have been finished then the trophies will be awarded and the tournament will end. However, if less than 50% of the tournament is completed then it will end, but without any trophies being given. I think that this seems fair.

Advert Boosting
Most people on the site and those who read here will know of my slight obsession with website statistics, so it will come as no suprise that I've been studying the logs for the Google advertising that I pay for. I've discovered which particular keywords are the most effective search terms are most likely to get people who click on my add to sign up, and now with any luck I'll have successfully modified it to get the cost per sign up down from £0.22 to £0.13. That means we may be getting around 60% more signups now, and that makes for a pleased Ste (me).

New Chess Set
Bandgeek2407 on the website has made a new chess set and uploaded it for everyone to use. The pieces are based on the "3D Type 1" set made for the site by Matthew Howlett, but have some lovely extras added to them. Here's a screenshot of them:

This prompted me to make a nice bit of javascript that allows you to preview chess sets and chess board in the preferences page before you apply them. It works quite well, so now all we need is a lot more custom sets. Keep up the good work!

Wednesday, February 01, 2006


Today Microsoft released a beta preview of Internet Explorer 7, scheduled for release later this year. Since within 12 months I estimate that half of the site's visitors will be using it I thought I'd better give it a try. The first site I went to was ofcourse, and sadly I am not impressed. There are a lot of glitches in it that make the site very hard to use. Have a look at this screenshot:

1) The "submit move" button is in the wrong place and overlaps the other move options.

2) My name has been cut off. It reappears when I hover over it, but then goes again.

3) The game information is supposed to be in a tooltip style box. Why doesn't it show here?

These are all very basic things which work just fine in every other browser I've ever tried (Internet Explorer 6, Firefox (all versions), Netscape 7 and 8, Konquerer). This annoys me slightly.

In fairness, this is only a beta, but I really hope that they get these things sorted out. In the meantime I'm going to have to rewrite bits of my code to ensure that it will all display properly in IE7, just in case they don't fix it. Annoying.

Tuesday, January 31, 2006

Updates Updated But Problems Still Problematic

The updates mentioned in my previous post about the code that deals with making chess moves is now running on the site and no one even noticed the transition. I think the site's working faster now, or at least it doesn't slow down like it sometimes did. However, we need to monitor this over a longer period than just a few days. There's undoubtedly further performance tune ups I can do and over the coming months I will do them.

An Old Glitch
Remember the problem where sometimes a move would be registered twice, causing a piece to dissappear and the moves list to get out of sync? I do. I thought I'd fixed it by putting in a check to make sure that the coordinates of this move aren't the same as the coordinates of the last move, so this would prevent duplicate entries. Well, BigD somehow managed to make two unique moves in one go! How he did this is a mystery, but obviously the code that checks for a duplicate was useless here because move 2 was completely different to move 1. I now need to be more cunning in preventing this sort of thing. I have a plan...

Friday, January 27, 2006

Tournaments Have Backfired!

It's been a long week since I last posted, but not a lot has happened really. The site has been plodding along nicely although last week's 2000 moves per day average has shrunk back down to 1000 moves per day. I'm not sure what was special about last week, but hopefully it will return soon.

The title of this post may confuse you somewhat, especially since tournaments were like the promised land of the site, so let me explain. To put it simply, too many people have created tournaments. This has led to a situation where tournaments are taking several weeks to have their seats filled up and people get fed up with waiting. Therefore I've implemented a new rule in the site's logic:

A tournment can only be created if the total number of empty seats is less than a quarter of the total number of members active in the last 7 days, or:

S < M/4

where S is the number of empty seats and M is the number of active members. I may play around with this ratio, but currently this means there needs to be less than 29 empty seats before a new tournament can be created. Let's just say that we're way over this mark at the moment! I'm hoping that this will fix this unusual problem :)

Performance Boosting
Last weekend I started rewriting a lot of the code that makes chess moves. I plan on finishing that work this week and uploading it. I don't know if there will be a noticeable speed increase, but the server will definately be less stressed during busy times. The code that makes the moves was almost a year old, and in that year I've learnt a lot more about how to optomise PHP code and database access. It will be interesting to see what I can do with it a year from now!

Stats Galore!
Regular readers will no doubt be aware of my fascination with the web site's statistics. Well, courtesy of Google I can now collect a lot more stats about the site, for example where people exit the site, how many people sign up as a result of a Google ad and so on. This has led me to optomise the Advertising system I use with Google and will now hopefully get far more members for the same amount of money. Now, if only I could work out why yesterday Google says I had a 133% sign up rate...!

One of the other drawbacks of tournaments is that there are far fewer open games created, and thismay mean that less members stick around. What I'm planning on doing is having some sort of volunteer scheme where reliable members can opt to be in a list that's shown to new members. The newbies can then click on a player to start a game with them instantly. It's just so that they can get started with the site pretty quickly and hopefully stick around. Obviously the definition of a 'reliable member' will be subject to speculation, but I'm thinking along the lines of at least 10 completed games and no losses due to inactivity. Hopefully this will help keep more new members active.

Friday, January 20, 2006

Potential Problems?

Yesterday a couple of strange things happened on the site:

No Check Mate Detection
A game that should have been check mate was not registered as such. There have been over 1000 games since this problem was fixed so I don't know what caused this one. I replicated the game on my test site and made the final move and it ended perfectly well.

False En-Passant
A pawn was captured by en-passant - by a knight! I definately remember fixing this bug so I've no idea why this would have happened.

Looks like I've got my work cut out for me this evening :(

Wednesday, January 18, 2006

New Calculations

I know I might sound like a broken record sometimes, but I really am fascinated about how many moves are being made. Over the last few days there have consistently been over 2000 moves per day! That means that if the site stays still we will reach 800000 by Christmas, that's almost double what I originally estimated. When you take site growth into account then we're more likely to reach a million by autumn (fall). As with many things, this got me thinking. How many moves per day could the site currently tolerate? With 2000 it's doing pretty well, with a move every 43 seconds. I think that we could manage 5000 a day (1 every 17 seconds) without too much of a struggle, but beyond that I'm going to need to speed things up inside. Not that I ever turn my nose up at such a challenge though :) I wonder how many moves per day some of the big sites have?

Monday, January 16, 2006

High Moves Average

On Thursday afternoon we finally passed the 100000 moves milestone, and it was Liquid_Crusader who made it. His mug has been sent to him and should arrive soon. It is now Monday morning and we are on over 105000 moves, so that's 5000 moves in less than 4 days, so an average of well over 1000 moves per day. If you consider that there are 365 days in a year, that means at the site's current rate we will reach half a million moves before Christmas. However, a quick look at the site's graphs shows that it doesn't stay at the same rate but has been consistently growning over the last 35 weeks (since I started logging the statistics). Therefore, I am fairly confident that by the end of the year we will have actually reached 1000000 (yes, a million) moves.

Lots of Users
Last night I logged on at about 21:15 and saw that there had been 23 users online just 10 minutes earlier. That was without Ruthie or myself online, so had we been there it would have been 25 users. This got me thinking, I used to be amazed to see 5 people online at once and was pleased at how busy things were, but now I consider that to be quiet. By the end of this year I imagine that seeing 20 people online at once will be a quiet time and it will be common place to see 50+ players at once. I can't wait :)