Roller chess

Roller is a fun little javascript chess engine program that only knows the rules (except 3-fold repetition).  It has absolutely no semantic knowledge at all, not even the relative piece values.  It plays by performing thousands of totally random games (rollouts) from the current position.  There is no search strategy as such at all.  In effect it’s a “pure” MCTS algorithm.  Wins, losses and draws are scored 1, -1, 0 and it simply chooses the move with the highest net score.  Obviously at the start of a game this is mostly just random play but it can avoid mate and give mate when they are clearly in sight.  You can play Roller here:-

The “kr/s” figure is showing thousands of complete rollouts (random games) per second.

Interestingly when pitted against a true random mover version of itself, Roller wins all of the games, other than sometimes accidentally falling into 3-fold repetition because it does not know that rule.

Roller can be used in Arena etc like Lozza.

Roller source is here:-

If rollouts last longer than 450 ply, a draw is assumed, as some crazy games can last longer than 1000 ply.  This does kinda of compromise the no-knowledge (or “zero”) element, but I can live with it.

It does not terminate at known draws like KK for example, because that is  definitely feeding in knowledge; however tempting it is to do so in the name of kr/s.

You can change the number of seconds Roller takes to move from the entry field above the board, which by default is 10s.

While thinking Roller displays a status above the board of the form:-

time so far (seconds) |
thousands of rollouts (games) so far |
thousands of rollouts per second so far |
best move so far

After moving Roller displays the net score and number of rollouts for each  legal move, for example:-

e6 9 / 1150
d5 31 / 1192 ****
d6 -8 / 1197

**** depicts the best score and the move chosen.


The Sailwave name

Version 1 of the software was called “Blow” and it was available on a 3.5″ floppy disk.  Sadly I do not have one.  My wife Sheena was not fond of the name and one day, together with our friend Martin Stephens, we had a brainstorming session.  It was Sheena who at some point said “sail wave”.  That was it – bingo.

I googled (or maybe yahooed) “sailwave” – nothing – so I was able to register and

I also registered but have done nothing with it.

Amusingly when you google sailwave these days you also get images of a Wave 38 class superyacht called Admiral Sail 🙂

The Sailwave logo

The Sailwave logo went through a few iterations.  The first was a similar sail/wave icon but the sail was convex.  Currently I cannot find any examples of it.  The font used for the text was Joker.  I showed it to my friend Mark Pressdee who suggested it needed to be “more serious” and I switched to Napa SF.  I can remember being a bit disappointed at Mark’s reaction at the time because I thought Joker was cool, but part of knew knew he was right and thank goodness for that because Joker is another Comic Sans these days 🙂 Later I redrew the sail in a concave way; a scan of which is below. This has been used in all Sailwave logos since.  It’s never been professionally drawn.


Connecting node.js to stdin/stdout

The context here is a UCI chess interface such that the Javascript chess engine running in node.js can communicate with standard chess UIs like Arena and Winboard.

My own full UCI interface can be found here in the lozUCI class and also some initialisation code (like that below) at the end of the file.

If you mine it for your own projects please attribute and link back here.


var nodefs = require('fs');


process.stdin.on('readable', function() {
  var chunk =;
  if (chunk !== null) {
    onmessage({data: chunk});

process.stdin.on('end', function() {

The UCI commands are then available in in onmessage().  Note that more than one command can be present separated by \n and depending on OS also \r, so assume \n and filter out \r.  In my own experience null commands can be present \n\n, so watch out for those too.


var str = ''
nodefs.writeSync(1, str + '\n');

The use of writeSync() is so that that the PV feedback displays in chess UIs like Arena and Winboard in real time.  If you write using async functions it appears all at once when the best move is sent back.

It’s useful to call the capture function onmessage() because that what web workers assume, thus it can be used in both web and node.js contexts.


Born in 2001, Sailwave is my sailing scoring application. It is used at all levels of the sport, from club racing to world championships.

Very early versions were a traditional database structure.  It was a friend Chris Solley that suggested a more spreadsheet-like approach.

During early development ISAF International Judge Eddie Ramsden was very helpful with rules interpretation.

Mumbles Yacht Club (my home club) was the first adoptee.

Mark Jardine of Yachts and Yachting supported Sailwave from the very early days in many ways including distributing Sailwave CDs at the Dinghy Show, a dedicated section for Sailwave in their forums and an early entry in their online store.

In April 2001 Simon Smith set up a Yahoo group called the Sailwave User Group (SUG).  It’s still going strong today.

In 2007 Sailwave was used at the Qingdao Olympic Test Event in China.  A chinese locale (user interface translation) has been available since then.

Speaking of locales, the English user interface has been translated by users into German, Italian, Polish, Danish, Chinese, Swedish, Romanian and Norwegian.

In 2012 the Welsh Yachting Association presented me with an Outstanding Contribution Award.

Due to illness, in 2012 Jon Eskdale took over the majority of development.

Also in 2012 Huw Pearce started looking after the Sailwave facebook page and now handles a large fraction of the SUG questions.  He also uses Sailwave to score events all over the world.

In 2013 I was awarded the Royal Yachting Association National Award having been proposed by Alyson Nicholson of Mumbles Yacht Club (with encouragement from Eddie Ramsden).

Between 2001 and 2012 my pub conversation was pretty much Sailwave based, so thanks very much to my family and friends for putting up with me, especially Sheena, Ben, Laura, Simon, Martin, Mark, Dave, Chris 🙂

Sailwave will always be free of charge to the sailing community.

Dart 18 Euros
Dart 18 Euros
Tony and Jo
Me and Chris O at the Dart Worlds
Me and ChrisO at the Dart Worlds
Martin and Bryn at the 2011 Olympic test event.
Shirley and Sailwave 🙂
Tony and Jo
My F18
Tony and Jo

Integrating Lozza into your project

You are free to integrate an unmodified Lozza into your own non-commercial projects. In return please link to If you wish to modify Lozza please email me for a chat first:, thanks.

The Lozza engine itself is self-contained in a single Javascript file (link at bottom of this post) and typically runs in a web worker.  A controlling program  can communicate with Lozza using the string based UCI protocol over the JSON web worker interface.

This is a very simple example:-

It fires up Lozza in a web worker and asks it to find the best move for a 10 ply search, sending all output to a HTML element called dump using jQuery:-

It looks like this:-

var lozza = new Worker('lozza.js');

lozza.onmessage = function (e) {

lozza.postMessage('uci');         // get build etc
lozza.postMessage('ucinewgame');  // reset TT
lozza.postMessage('position startpos');
lozza.postMessage('go depth 10'); // 10 ply search

Lozza can auto-detect if it’s running in a node.js context allowing seamless use online in a browser context and offline in node.

This allows Lozza run both online and offline on pretty much any platform, including Windows, Linux and Mac.

For example this image is a dump of the same 10 ply search using node from the Windows command line:-

The “info string debug…” lines show overall time and node count etc and are not strictly part of the UCI protocol.  You can either filter them out or change this.debugging to false in the UCI class.

Lozza can be used outside of a web worker by including lozza.js in your HTML file and then using the loz* classes directly.  This is useful for profiling etc.

The Lozza source itself is here:-

You are also free to mine any of the example user interfaces, but please do let me know what you use and credit appropriately; thanks.

Using Lozza offline

Command line, Winboard, Arena etc.

Lozza needs a Javascript engine to live in.  Usually this is supplied by a web browser, but other applications also embed Javascript engines, the most common and flexible being an application called node.js, allowing you to execute Javascript outside of your browser. node.js is available for most operating systems, including Windows, Linux and Apple.

Download and install node.js (if you get a choice of engines choose google Chrome V8).  node.js adds itself to your path and this is assumed in the example commands below.

Download Lozza from:-

Save into a folder of your choice.

To use from the command line do something like:-

cd lozza folder
node lozza.js

If that fails maybe node is not in your path, so either use an absolute directory to address node or tweak your path.

To use in a chess UI like Arena or WInboard, use node.exe (etc) as the chess engine and lozza.js as a command line parameter.

To enter a Javascript engine into HG Muller’s monthly chess tourney. First ask him for a user name and password and install Winboard. Then connect with something like this from the winboard directory itself:-

winboard -zp -zippyGameEnd "say Thanks for the game." -ics -icshost -icshelper timeseal -fcp "c:\nodejs\node.exe c:\lozza\lozza.js" -fd . -autoKibitz -fUCI -keepAlive 4 -firstXBook