KGS Leben: Autumn Update

Here, in the Northern hemisphere, Summer has rolled past and it is Autumn once again. The leaves are turning on the trees, the wind has picked up, the temperatures have plummeted, the weather in the Alps is cold and wet and Federweiße and every variety of Kürbis adorn the shelves in the German supermarkets.

I have finally found time to write gratuitous code and I even played a whole game of Go, yesterday!

I have committed to KGS Leben twice in the last week. Here follow the highlights.

Sound Cues

I was not too surprised by the clamour for clicks and beeps. I did not intend on implementing them, yet, but recording and integrating sounds seemed like a creative way to resume work on the project and they were clearly desired by players so here they are.

This click was recorded, manually, and retouched in Audacity to remove the noise of my desktop microphone, fade it in and out and clip it so that it feels synchronised with the board when in use.

The pass bell was synthesised using a script in Audacity that implemented the work of Jean-Claude Risset.

Both of these sound cues should be played in all supported browsers, now, although Internet Explorer will play them with the obsolete HTML 5 Audio object instead of the draft Web Audio API published by the W3C and implemented by nearly all other browsers of import. In that case, concurrent instances of the same sound cue will be culled – this might be noticeable in blitz games.

Unit Testing

I have added some unit tests for domain-models such as the game-position and game-tree models and I intend to add many, many more. I know I should have done this a long time ago because development is always smoother when one possesses ability to automatically test not only existing code but changes and new code too.

To write the unit tests, I have used Mocha.js. It works acceptably well, in general, and is actually quite good for JavaScript. In my development environment, I can even attach to the Node.js debugger and step through my code, using source-maps so that I can work with the original TypeScript sources. Development for the Browser is almost becoming civilised!

Microsoft Internet Explorer

The player-panels are no longer a complete dog’s breakfast in Microsoft’s quirky browser and several other odd glitches have been fixed. I have tested under MSIE 11 and under MS Edge and both appear to work.

The list of tested browsers now includes Firefox, Chrome, Internet Explorer 11 and Edge. Opera and Safari (desktop, not mobile) should be supported but I have not tested under them. Internet Explorer 10 might be usable – I will probably test it at some point, if only for amusement purposes.

Ko Centres marked on the Board

2016-10-01-ko-marker

The picture on the right says all that needs saying.

Behind the scenes, both the last-move marker and the Ko marker are now part of the game-position schema, making it incredibly easy to cover them in the unit tests for that model.

I also re-wrote the way that Ko is detected – the new implementation is much cheaper than the old one which relied on comparing positions in the active branch of the game tree.

The server implements the Ko-rule but it also necessary to implement it on the client in order to draw the marker and to avoid sending illegal moves to the server only to have them rejected.

Pass, Resign and Done Buttons

Prompted by feedback, I went searching for these three buttons and discovered that they were suffering from some sizing problems and they were completely hidden in Internet Explorer. These issues are now fixed. I have also tested them and they work as expected.

Here are the pass and resign buttons when the player-panels are positioned above and below the board:

This slideshow requires JavaScript.

When it is one’s opponent’s turn to move, the pass button is disabled. Clicking either button shows two secondary buttons. Clicking the second of these, the colourful one, will confirm the action, playing a pass-move or resigning the game. Clicking the other, or anywhere else for that matter, will cancel the action.

Here are the buttons when the player-panels are positioned on the left- and right-hand-sides of the board.

This slideshow requires JavaScript.

In this set of screenshots, you can also see the done button. During the scoring phase, the pass button morphs into the done button – a logical evolution.

KGS Leben is Open Source

Visit GitHub for the source code, along with instructions for building, testing and hosting the application. Features requests and bug reports may be submitted to the GitHub issue tracker for the project and open discussion can be found here, in the comments section, or in the Life in 19×19 thread related to the project. All project artefacts are released under the MIT License.

Advertisements