chrss update 8

April 28th, 2007

Nearly a month since the last update, but there’s a few new things:

  • user niceties such as being able to change your password and resetting forgotten passwords
  • user rss feeds now filter out that user’s own moves (so you no longer get notification after you’ve just moved – only when your opponent has moved)
  • list of all games and user’s game list now sorted by most recently updated
  • “greyed out” piece now shown to indicate previous position of piece when previewing a move and when browsing moves (as discussed here)
  • dedicated page for creating a new game – to be expanded further

chrss update 7

April 1st, 2007

Few minor background tweaks, but the major new feature in this upgrade is that you can now get an aggregated rss feed for all of a user’s games. e.g.:

http://psychicorigami.com/chrss/user/lilspikey/rss

Is the rss feed for all of my games. If you are playing several games (as I have been) this means you only need one feed instead of one for _each_ game.

The only other visible tweak is that the auto-generated keys for games are now shorter and thus (hopefully) easier to mail around.

chrss update 6

March 30th, 2007

So I’ve now uploaded the results of the saturday morning code-a-thon. This means that you can now browse all of the previous moves and they also have a convenient URL. So if you want to show someone a move that you thought was particularly good/bad you can just send them the link. e.g. in this pretty amazing (fun at least) game against Kennon, I was particularly proud of this move:

http://psychicorigami.com/chrss/game/9/browse/29

Pretty happy with what I’ve got implemented for chrss now. This features take it slightly past the core ability to “just play chess”. Hopefully I can start leveraging the fact that everything is being recorded in the database and is now “just data” that can be manipulated and viewed in different ways. Though I think I might spend a bit of time on some of the more mundane aspects first (like being able to reset your password).

On a more technical note, starting to feel a lot more like I really know my SQL now. Been proficient at it for a while, but I was quite proud of this:


alter table move add column move_num int;

-- temp table for calculating the move numbers
create table tmp_move (moveid int,movenum int);
-- insert move numbers into tmp table
insert into tmp_move (moveid,movenum) select id as moveid, (select count(*) from move m2 where m2.id <= m.id and m2.game_id = m.game_id) as movenum from move m;
-- then update moves from tmp table
update move set move.move_num = (select movenum from tmp_move where tmp_move.moveid = move.id);
-- remove tmp table
drop table tmp_move;

-- increase constraints on the move_num values
alter table move modify column move_num int not null;

alter table move add unique game_move_num_index (game_id, move_num);
alter table move add index move_num_index (move_num);

Which basically adds a “move_num” column to the move table and the calculates the correct value for each move (i.e. whether a move is move 9, 10 etc. in a particular game). Previously I was calculating this on the fly, but that was forcing me to always read all of the moves for a game. This should make things a bit simpler for me down the line. Just a shame I couldn’t do it without a temporary table.

saturday morning code-a-thon

March 24th, 2007

For some reason I seem to be getting up early at the moment and coding. Just had a pretty good intense coding session and managed to get a whole load of stuff done to chrss. So good when you get that feeling of “flow”.

So needs testing before I deploy the new version, but in principal the following are now done:

  • move confirmation
  • browse moves (see what the board looked like at every point in the game)
  • RESTful style URLs
  • 301 redirects for old URLs to new URLs
  • unit tests

The last one will be increasingly important, as it means I can be increasingly certain that everything is working properly. Most of the unit tests so far are for the “model” part of the app. In this case that means I’m mostly testing the actual chess part of the code.

I based the REST code on this recipe for turbogears and tweaked it a little.

The RESTful URLs also help me organise my code better and just seem friendlier in general. One other side effect is that you will be able to/can browse the potential moves as normal links and don’t have to be logged in to do so. So for example you would click on a piece to see the available moves, then on the move you want and you’d see something like this in the browser address bar:

  1. http://psychicorigami.com/chrss/game/11
  2. http://psychicorigami.com/chrss/game/11/14
  3. http://psychicorigami.com/chrss/game/11/1423

Where 11 is the game #, 14 is the position of the piece and 1423 is the final move you want to make (in ICCF notation).

So hopefully I’ll get this online next week (probably after the £5 app meet).

Longer logins

March 14th, 2007

Just tweaked some settings, so logins to chrss shouldn’t expire for a couple of days – instead of after twenty minutes. It was getting annoying having to log in all the time…

Chrss update 5

March 8th, 2007

Another minor update to chrss. Changes:

  • captured pieces are displayed in a summary next to the user’s name
  • rounded corners (thanks to MochiKit)

Other than that my losing streak continues. That game contained a move I immediately saw as being wrong after I did it, so I think one of the next features to add will be a “preview” screen. Hopefully the changes needed to do that will also make it easy to do an action replay of the moves in a game.

$5 Apps – a new geek meet

February 28th, 2007

It appears that I’m helping organise “$5 Apps – a new geek meet” with Ian. Should be interesting.

Planning on giving a talk about setting up chrss and Ian will be talking about ShowMeDo. With luck we’ll get a few other people along to talk about their “$5 apps” in the future.

Chrss update 4. Game 2 – Kennon wins

February 26th, 2007

Well I ended up not doing so well against Kennon in the end.

To be able to finish the game though I needed to add the ability to resign from a game. So now when you are logged in you will see a “resign” button (if it’s your turn to move). You’ll get a javascript confirmation dialog (to make sure you didn’t press it by accident) and then that’s it – your opponent wins.

Couple of other minor things added, so total new features/fixes as follows:

  • can now resign from games
  • stalemate now being checked for
  • the final result of a game now appears in the rss feed

Chrss update 3

February 23rd, 2007

Just done:

  • user account creation now does email validation (more useful for myself)
  • ordering rss entries in date order (as some rss readers seem to display entries in the order the entries appear in the file), to ensure most recent moves appear first

TODO:

  • move confirmation (probably just with javascript), to avoid accidental moves
  • ability to resign/concede and draw games
  • check for stalemate
  • rss notification of user joining games (and other such events)

Overall development on chrss is still going well. I’d classify it as being in “alpha”, but that’s more to do with it missing a few features than it being riddled with bugs (well at least I hope so). Once the features listed above are finished I can probably consider it as being in “beta” and the I’ll move it over to an easier to remember domain (which I acquired yesterday).

Second game. End game

February 14th, 2007

lilspikey_vs_kennon.gif

Well game #2 is in the end game now. It’s been really good playing against Kennon. Must say that I’m not faring terribly well, but it’s not over yet…