branches: main
Clone
clone: git://shithub.us/kitzman/chessfs gits://shithub.us/kitzman/chessfs
push: hjgit://shithub.us/kitzman/chessfs
patches to: kitzman@disroot.org
Last commit
470f19bc
– kitzman <kitzman@disroot.org>
authored
on 2024/01/26 09:22
added rc/replay
About
CHESSFS(4) CHESSFS(4)
NAME
chessfs - chess filesystem
SYNOPSIS
chessfs [-verbose] [-addr addr] [-srv srv] [-group gid]
chessterm [-font path] [-bg col] [-fg col] player directory
uciconnect [-think time] [-wait time] [-player p] -dir game
command
rc/play [-r] player directory
rc/spectate [-r] directory
rc/replay [-skfdch] chessdirectory
DESCRIPTION
Chessfs is a filesystem for playing chess games. It posts a
server named after the argument, which by default is
"chessfs". Specifying a listening address serves 9p over
the announces address, instead of a server, or UNIX socket.
The files' username is the one running the program, and the
group can be set using the -group option.
The filesystem contains three files - ctl, clone and games.
Opening the clone file creates a new game, and the id can be
read from the fid. The game can be found under the games
directory, as a directory with the game id. Ctl is for read-
ing and setting server options. It displays the maximum
amount of games, and the current count of games. Setting
roomsize changes the maximum number of games which can be
played.
In each game directory, there are the ctl, white, black,
moves and fen files. Ctl supports the following commands:
time seconds Set the amount of time each player has. The
default value is -1 indicating that the game
is not timed.
start Start the game.
close Close the game, which may or may not have
ended.
The board files, white and black, show the current pieces'
position, depending on the player. Writing to the file makes
a move on behalf of the corresponding player.
CHESSFS(4) CHESSFS(4)
draw Offer a draw, or accept a draw if the other player
offered one.
resign Resign the game.
move Make the following move, following the algebraic
notation.
For reading the game in the PGN notation, the moves file can
be read.
The fen file can be used to read the FEN notation of the
current game. Additionally, writing to the file, before the
game is started, sets the pieces' position.
Chessterm is the user interface for the filesystem. It
assumes the game is already cloned, and takes as arguments
the player (either "black" or "white"), and the game direc-
tory. Every half of second the directory is checked and the
board is updated. A mouse action, or the pressing the space
key on the keyboard, retriggers an update. Mouse button 2
brings up a menu with the option to offer a draw, resign, or
start the game. When promoting, the pieces are shown in a
menu. The font used is the one either from the environment
variable, or from the argument. Additionally, the background
and foreground colors can also be set, based on which the
board is drawn.
Uciconnect can be used to connect a game directory, with a
process serving the UCI protocol via standard input and out-
put. There are two mandatory arguments: the game directory
and the command to execute. The -think arguments sets the
time the engine is allowed to find a move. Between commands
and reads, the program sleeps a duration, which can be set
via the -wait option. By default, the engine plays the white
player, which can be set with the -player flag.
Play is an interactive script which prints the board and
game status, and waits for your or your opponent's move. The
-r flag transcribes the UTF-8 piece symbols into other sym-
bols, in case the used font doesn't have them. Spectate is a
similar script, only printing the board updates. Replay can
be used to replay games, with -s seconds between moves. The
PGN is read from standard input.
EXAMPLES
Run the filesystem:
chessfs -srv chessfs -group chessclub
mount /srv/chessfs /n/chess
Create a new game, set parameters, and play:
CHESSFS(4) CHESSFS(4)
cd /n/chess
cd games/`{cat clone}
echo time 1800 >ctl
echo start >ctl
echo e4 >white
sleep 1
echo resign >white
SOURCE
https://git.disroot.org/kitzman/chessfs
https://shithub.us/kitzman/chess/HEAD/info.html
BUGS AND TODO
Menus don't work with plan9port's devdraw. I have only
tested this, once, on a Linux machine.
Encrypting connections should be an option.
Currently players cannot change the owners of the files.
That means anyone can take over the game.