Post is pinned.Post has attachment
Overview

Lozza is a simple client-side #Javascript #chess engine, currently rated about 2450 ELO on CCRL. You can play, analyse and train with Lozza here:-

http://op12no2.me/toys/lozza

You can use an unmodified Lozza in your own Javascript projects, but please attribute Lozza with a link back to here.

You can use Lozza offline in standard chess user interfaces like Arena and Winboard.

See the other posts in this collection for further information.
Photo

Post has attachment
Integrating Lozza #chess into your project

You are free to integrate an unmodified Lozza into your own non-commercial projects. In return please link to the Lozza google+ collection. If you wish to modify Lozza please email me for a chat first: colin@sailwave.com, 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:-

http://op12no2.me/toys/lozza/ex.htm

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) {
$('#dump').append(e.data);
};
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:-

https://drive.google.com/open?id=0ByH7ApoF-KoFcTY5R3ZwZHE5V0E

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:-

http://op12no2.me/toys/lozza/lozza.js

You are also free to mine any of the example user interfaces in the Lozza chess google+ collection, but please do let me know what you use and credit this site; thanks.

Post has attachment
Using Lozza #chess offline

This note applies to all chess user interfaces.  The Arena UI is just used as an example below.

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:-

http://op12no2.me/toys/lozza/lozza.js"> lozza.js

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 see the image below.

i.e. 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 http://winboard.nl -icshelper timeseal -fcp "c:\nodejs\node.exe c:\lozza\lozza.js" -fd . -autoKibitz -fUCI -keepAlive 4 -firstXBook

Photo

Post has attachment
Lozza #chess analysis UI

Allows you to set up positions and analyse them.

http://op12no2.me/toys/lozza/fen.htm

Optional URL parameters

fen=fen

Load the specified FEN as the position to analyse.

act=ana

Auto start an analysis.  Be a little bit careful about using this as some people do not like their computer to use a lot of CPU time on an analysis without them starting it explicitly.

act=eva

Auto start an evaluation.

Example:-

http://op12no2.me/toys/lozza/fen.htm?act=eva&fen=5k2/p7/3R4/2p3p1/1bP3P1/5N1P/3p1PK1/3r4
Photo

Post has attachment
Lozza #chess play UI

Play black or white against Lozza.

http://op12no2.me/toys/lozza/play.htm

No proper time controls. Lozza takes N seconds to move as specified by you in the text field above the board. The default is 1 second. You can change the value at any time during the game.

Optional URL parameters

h=y

Hide Lozza's workings other than announcements of mate and the info above the board.

c=b

You play black. Default is you play white.

t=secondspermove

Lozza uses specified number of seconds to make her moves. Default is 1. For example to play at 10 seconds per move and you play black use:-

http://op12no2.me/toys/lozzadev/play.htm?t=10&c=b

fen=fen

Use the specified FEN string to start the game from. The default is the standard start position.

m=ucigocommand

Lozza uses the UCI go command to make her move rather than the fixed time. For example to ask Lozza to search to a depth of 2 ply only use:-

http://op12no2.me/toys/lozzadev/play.htm?m=go depth 2

Another example, to ask Lozza to make her move after searching 100000 nodes, use:-

http://op12no2.me/toys/lozzadev/play.htm?m=go nodes 100000

This can also be used to play with a fixed move time of less than 1 second, for example to make Lozza move after 200ms use:-

http://op12no2.me/toys/lozzadev/play.htm?m=go movetime 200

NB: google+ does not like the spaces in the URLs so copy and paste the whole thing or add the extra text after clicking on the last 3 URLs.
Photo

Post has attachment
Lozza #chess mate-in-1 trainer

http://op12no2.me/toys/lozza/mate.htm

You must solve 10 mate-in-1 puzzles against the clock.  Time penalties are added for illegal and wrong moves.  You must drag the piece to the mating square to solve the puzzle.  The puzzles are loaded at random from a large collection sourced from here:-

http://www.talkchess.com/forum/viewtopic.php?t=55104

All the puzzles are loaded to your computer the first time you play. It can take a little while depending on the speed of your internet connection.

Please let me know if you'd like to see any other trainers.
Photo

Post has attachment
Lozza #chess console UI

This Lozza UI allows you to type UCI commands in a console-like manner.

http://op12no2.me/toys/lozza/console.htm

COMMAND EXTENSIONS

In addition to the standard UCI protocol , the following commands can be used:-

stop

Stop the Lozza engine.   Useful to stop a long perft or analysis.  What actually happens is that the web worker containing Lozza is killed.  You'll need to restart one.

start

Start Lozza.  i.e. create a new web worker containing the Lozza.  After a start the following are automatically sent:-

uci
ucinewgame
position startpos
board

A start command is issued when the console UI starts.

clear

Clear the previous output.

board

Display a textual FEN and graphical representation of the current position.

perft depth d [moves m] [inner 1|0]

Perform a perft analysis to a depth of d ply based on the current position.  m is the expected number of moves and is optional, defaulting to 0.  inner 1 will show inner node counts with the default being inner 0

eval

Show how the static evaluation of the current position is constructed.

id idstring

Attach an identification label to the current position.  Only relevant if UCI debugging is on.

ping

Check that the engine is alive.

SHORTCUTS

u == ucinewgame

q == quit

p == position

p s == position startpos

g == go

g d = go depth

b == board

NOTES

An explicit ucinewgame is needed to reset the transposition tables; and is required before the first position.  It is optional during a game since it has no effect other than to clear the TT.

Lozza plays it's best move  when a  go command completes, changing the current position.

The current position is unchanged after a perft

The start, stop and clear commands are not be available when using Lozza offline; for example with node.js.  Similarly only the textual board representation is shown.

Post has attachment
This is a version of Lozza #chess that uses a single simple metric for it's evaluation function; there is no material evaluation at all.

Can you guess what the metric is based on the style of play?

http://op12no2.me/toys/lozzamystery/play.htm

#javascript
Wait while more posts are being loaded