diff --git a/xtrn/chess/xboard.js b/xtrn/chess/xboard.js index c84c6daf834f9d9298710da3943f36d405078ba3..b1e5b90c7e9164eb23af9db6b268a8082f528ed9 100755 --- a/xtrn/chess/xboard.js +++ b/xtrn/chess/xboard.js @@ -10,6 +10,7 @@ var piece; var f=new File("/tmp/chesslog.txt"); var reason; f.open("a"); +f.truncate(0); while(1) { cmd=readln(); @@ -22,24 +23,27 @@ f.flush(); piece=b.getPiece(parsePos(m[1])); if(piece) { if(piece.moveTo(m[2])) { - print('move '+m[1]+m[2]); + write('move '+m[1]+m[2]+"\n"); f.writeln("Moved "+m[1]+m[2]); f.flush(); break; } else { - print('Illegal move (no worky): '+m[1]+m[2]); + write('Illegal move (no worky): '+m[1]+m[2]+"\n"); f.writeln('Illegal move (no worky): '+m[1]+m[2]); f.flush(); } } else { - print('Illegal move (no such piece): '+m[1]+m[2]); + write('Illegal move (no such piece): '+m[1]+m[2]+"\n"); f.writeln('Illegal move (no such piece): '+m[1]+m[2]); f.flush(); } } break; + case 'protover 2': + writeln('feature\n'); + break; case 'new': b=new Board(); break;