technology

Some Chess 2.0 (Final Release)

The final release of Some Chess 2.0 is out now. It is, as far as I know, completely bug free.

Now it is time to gear up for version 2.5. Mostly that means adding translations, that’s going to be the focus. But there will also be a limited number of new features.

The big news is that the forum on sourceforge will be shut down soon and support will be moved to the Some Chess website.

Also, there will be a wiki with the aim of making translation work easier for everyone. The wiki will probably also have a documentation focus, but the big thing is getting the translation done in as many languages as possible.

Thanks to everyone who’s help in so many ways to make Some Chess possible!

    Changes in Some Chess 2.0

  • fixed “problemo” bug
  • fixed what I think is the final checkmate bug!
  • other minor code improvements
Standard
technology

A PHP Fischer Random Chess Function

This is of limited use, but I thought I’d share the source code to a function I wrote the other day to setup a game of Fischer Random Chess, also known as Chess 960.

The basic idea of Fischer Random Chess is that you shuffle up the back row. The rules say that; 1) the bishops must be on opposite colored squares, 2) that the rooks be on opposite sides of the king, and 3) that the black and white side must mirror each other. That’s it. The game is played out like a standard game of chess, though castling is a little tricky.

The function below outputs an array where the keys are correspond to squares on the board. The array values specify what pieces occupy each square. For example:

[c1]=>’rl’

means that a light (white) rook is at square c1. The pieces are noted with the standard letters (r,n,b,q,k). In theory it wouldn’t be hard at all to get it to output in FEN either, though (at the moment) I’m not interested in that personally.

I’ll be incorparating this into Some Chess, but it could be used in any program or used to setup a real world game too, you just need to work with the array. Check back soon and I’ll share the code used by Some Chess to display an array like the one outputted below as a graphical chessboard.

function fisher_random(){
// create an array of every possible square
$squares = array(0=>’a’,1=>’b’,2=>’c’,3=>’d’,4=>’e’,5=>’f’,6=>’g’,7=>’h’);

// the get the bishop first
$tmp = array_rand(array(0=>’a’,2=>’c’,4=>’e’,6=>’g’)); // bishops must be on opposite colors, so only offer one color to each bishop
$bishop1 = $squares[$tmp];
unset($squares[$tmp]); // remove the square the bishop got from the array of possible squares

// get the second bishop
$tmp = array_rand(array(1=>’b’,3=>’d’,5=>’f’,7=>’h’));
$bishop2 = $squares[$tmp];
unset($squares[$tmp]);

// place the queen
$tmp = array_rand($squares); // just use php’s array_rand() function to pick from the array of possible squares
$queen = $squares[$tmp];
unset($squares[$tmp]);

// place one knight
$tmp = array_rand($squares);
$knight1 = $squares[$tmp];
unset($squares[$tmp]);

// place now place the other knight
$tmp = array_rand($squares);
$knight2 = $squares[$tmp];
unset($squares[$tmp]);

// take what is left and place the rook, king, and other rook— in that order
$i=0;
foreach($squares as $tmp){
if($i==0) $rook1 = $tmp;
if($i==1) $king = $tmp;
if($i==2) $rook2 = $tmp;
++$i;
}

// return an array of the pieces, the array keys correspond to the squares and their values to pieces occupying those squares
return array(
$rook1.’1’=>’rl’,
$rook2.’1’=>’rl’,
$knight1.’1’=>’nl’,
$knight2.’1’=>’nl’,
$bishop1.’1’=>’bl’,
$bishop2.’1’=>’bl’,
$queen.’1’=>’ql’,
$king.’1’=>’kl’,
$rook1.’8’=>’rd’,
$rook2.’8’=>’rd’,
$knight1.’8’=>’nd’,
$knight2.’8’=>’nd’,
$bishop1.’8’=>’bd’,
$bishop2.’8’=>’bd’,
$queen.’8’=>’qd’,
$king.’8’=>’kd’,
‘a7’=>’pd’,
‘b7’=>’pd’,
‘c7’=>’pd’,
‘d7’=>’pd’,
‘e7’=>’pd’,
‘f7’=>’pd’,
‘g7’=>’pd’,
‘h7’=>’pd’,
‘a2’=>’pl’,
‘b2’=>’pl’,
‘c2’=>’pl’,
‘d2’=>’pl’,
‘e2’=>’pl’,
‘f2’=>’pl’,
‘g2’=>’pl’,
‘h2’=>’pl’);
}

Standard
technology

Some Chess 2.0 release candidate 3

My fingers are crossed… it looks like this might be the last (or near the last) version of Some Chess before it is a full release. I’ve been working on Some Chess for almost a year now, and while I can see places to improve I have to say that I am pleased with the progress from the first version to what will be version 2.0

A big thanks to the folks that have helped Some Chess along the way.
DownloadMore Info

    Changes for this version

  • fixed broken player stats
  • fixed issue where a person could make a move in another person’s game
  • fixed bug where very long usernames would mess up table on “view players” page
  • fixed “view game” bug where capturing/promoted pawns broke functionality
  • fixed scrambled board display in “view game” for IE
  • fixed bug where checkmate was sometimes incorrectly identified
  • optimized some code
  • added “snazzy borders” to some dialogs
Standard
technology

Some Chess 2.0 release candidate 2

Out today, Some Chess 2.0 rc2. This brings Some Chess one step closer to a final version.

DownloadMore Info

    Changes for this version

  • users created by importing pgn no longer appear on the players page
  • fixed problems with example_config.php file (Sorry!)
  • fixed a bug that broke the move notification email
  • fixed what I hope is the last checkmate bug
  • fixed broken chess board display in Internet Explorer (Sorry again!)
  • fixed bug that broke the Currently Online function
  • fixed urls on the help page (thanks David!)
  • fixed issue where auto-install/update failure message resulted in blank screen for some browsers
  • fixed issue where notation would fail to add the check “+” notation to pawns that capture and promote at the same times as putting a player in check (yeah, kind of rare)
  • added alt attribute to user image img element so menu is valid xhtml again
  • added “review” button to board screen (move-by-move replay)
  • added “random” as choice for piece color
  • added a bit to the French locallization (help!)
  • about page & players page are now valid xhtml
  • “deleted” players just removed from the list of players, they are no longer deleted from the DB
Standard
technology, whatnot

Some Chess 2.0 release candidate 1

some chess piece (knight)Some Chess release candidate 1 (my php chess program) is out now. From here on it should only be minor bug fixes. Localizations are needed, both updates and new ones. The French localization is terrible and half-done (I did it, so I can say that). The Spanish & Brazilian-Portuguese localizations need updating. I haven’t heard back from anyone else so all other languages are needed.

Speaking of bugs…. there is a tiny annoying one already. It breaks the Currently Online function. I’ve fixed it in the code, but don’t want to release another version so quickly. To fix it yourself find and replace “$now” with “date(YmdHi)” (no quotes for either of them) in the file menuPanel.php Sorry about the sloppy job there folks.

There will probably be new features in Some Chess 2.5, but at this point I want to focus only on bugs. Adding means more code to maintain and more code that could be buggy, but slow down the march towards 2.0

What I’m most happy about is finally getting rid of the old piece images and making my own. They aren’t so amazing that they are gonna break anyone’s eyes, but they work well I think. The demo as always is online for folks to see how it works.

Standard
technology

Here's Some Chess

Some Chess (Board)Sometime around May 2006 I got this idea to make a Chess server that uses only PHP. There are lots of boring reasons for the PHP part, but the reason for making the server was that I had friends who I played chess with and a bunch of people (including myself) we’re moving all over the place so it would be difficult to keep playing. I don’t like Yahoo, mostly because they help China to imprison people exercising free speech, so I need another option. I couldn’t find anything that fit what I wanted, so I thought, “why not make it.”

And so I began writing Some Chess, for a while the project took over my life, now it’s more laid back. I’m proud of how well it seems to work and that feel like the program strikes a balance of ease and features while looking pretty nice. Best of all the project is open source, so anyone can install it on their own server for free— modifying it as they see necessary.

I’ve just released the fourth beta version of Some Chess 2.0, hopefully this will be the last beta needed. From here it is a matter of getting translations, so far I only got Spanish, though I’ve been told there is a German translation on the way.

If you’d like to see how it works, there is a demo server.

[tags]chess, chess program, chess server, mysql, open source, php, php chess, some chess, web chess[/tags]

Standard