[ANN] chess puzzles on gemini

CΓ΄me Chilliet <come (a) chilliet.eu>

Hello,

After Tic Tac Toe, I worked on rendering a chess board in Unicode.

I did not find a nice way to color black squares, but it works.
Also, most gemini clients use dark themes and as a result inverse white 
and black colors on chess pieces.

You can get a random chess puzzle on gemini://chess.lanterne.chilliet.eu

The puzzle is taken from chess.com using their API. I looked into lichess 
API but did not find an endpoint for puzzles, and lichess returns PGN and 
my code was only supporting FEN.
Note that the API does not give the solution, so you cannot know if you 
succeeded without using HTTP.
But you can still use this page to work on your chess skills.

The page is not interactive. Note that implementing an interactive chess 
board could be done by using an input field and Algebraic notation.
But this would mean running a chess engine, and keep a server-side 
session, which I do not want to get into yet.

C?me

PS: and yes, it does mean I managed to use SNI to host several domain on the same server.

Link to individual message.

Adnan Maolood <me (a) adnano.co>


On Wed Dec 2, 2020 at 3:53 PM EST, C?me Chilliet wrote:
> Hello,
>
> After Tic Tac Toe, I worked on rendering a chess board in Unicode.
>
> I did not find a nice way to color black squares, but it works.
> Also, most gemini clients use dark themes and as a result inverse white
> and black colors on chess pieces.
>
> You can get a random chess puzzle on gemini://chess.lanterne.chilliet.eu
>
> The puzzle is taken from chess.com using their API. I looked into
> lichess API but did not find an endpoint for puzzles, and lichess
> returns PGN and my code was only supporting FEN.
> Note that the API does not give the solution, so you cannot know if you
> succeeded without using HTTP.
> But you can still use this page to work on your chess skills.
>
> The page is not interactive. Note that implementing an interactive chess
> board could be done by using an input field and Algebraic notation.
> But this would mean running a chess engine, and keep a server-side
> session, which I do not want to get into yet.
>
> C?me
>
> PS: and yes, it does mean I managed to use SNI to host several domain on
> the same server.

Looks cool!

You could use an approach similar to the one for Tic Tac Toe to avoid
having to keep track of server side state. There are only so many
possible combinations of chess pieces. You could encode the current
combination in a compact binary format and put that in the URL.
I might give it a try if I get a chance.

Link to individual message.

James Tomasino <tomasino (a) lavabit.com>

On 12/2/20 9:13 PM, Adnan Maolood wrote:
> You could use an approach similar to the one for Tic Tac Toe to avoid
> having to keep track of server side state. There are only so many
> possible combinations of chess pieces. You could encode the current
> combination in a compact binary format and put that in the URL.
> I might give it a try if I get a chance.

Perhaps you could use an FEN?

https://en.wikipedia.org/wiki/Forsyth%E2%80%93Edwards_Notation

Here's an example from a game I'm playing now:

r3kb1r/ppp3pp/2p5/4P3/3Pn1Bq/4B1P1/PPP4P/RN1QK2R b KQkq - 0 11

Link to individual message.

CΓ΄me Chilliet <come (a) chilliet.eu>

Le mercredi 2 d?cembre 2020, 22:16:50 CET James Tomasino a ?crit :
> Perhaps you could use an FEN?

As I explained in the first email I do use FEN, this is what I parse from 
chess.com to place the pieces.

But I thought FEN in URI would be ugly since it contains spaces.
Also it would make more sense to store the game in a session and have the 
moves history like what most chess programs are doing.

Something which should be easy to do is allow to spectate chess games on 
gemini using this board, and asking the user to reload the page when he wants an update.
Maybe when the candidates tournament starts again I?ll work on that.

C?me

Link to individual message.

Alex <alex (a) alexwennerberg.com>

Very cool! For you or anyone else interested, I put together a simple 
server that enables interactive chess games, but haven?t gotten around to 
deploying it ? https://git.sr.ht/~alexwennerberg/gemchess 

Alex

Link to individual message.

CΓ΄me Chilliet <come (a) chilliet.eu>

Hello,

There is now a webpage listing available games at gemini://games.lanterne.chilliet.eu/

And the code can be directly consulted on gemini://code.lanterne.chilliet.eu/

The server in there is getting more and more complete, if anyone is 
interested I could split MCMic\Gemini from the rest so that it can be used 
as a base for other PHP projects.
It?s still far from complete/perfect though.

Has anyone worked on content available in multiple language on gemini?
What is the most common practice, some /en at start/end of path, and links 
at the page bottom to switch language?

C?me

Link to individual message.

Sean Conner <sean (a) conman.org>

It was thus said that the Great C?me Chilliet once stated:
> Hello,

  Hello.

> Has anyone worked on content available in multiple language on gemini?
> What is the most common practice, some /en at start/end of path, and links
> at the page bottom to switch language?

  I'm working on that right now for GLV-1.12556 [1].  The planned support
(which should be available in an hour or so) is to allow a person to set
both the default language [2] and character set [3][4] server wide, per
host, per directory or per file [5] in the configuration file.

  There are other ways of solving this (special file extensions, a map of
filenames to languages, etc.) but that's how I'm solving this particular
issue.

  -spc

[1]	https://github.com/spc476/GLV-1.12556

[2]	No default.  If not set, the lang paramter for text/* MIME types
	will not be set.

[3]	Also no default, and I suspect no one will really use this except
	for maybe at the directory or file level for legacy text files.  But
	as long as I was doing the lang= parameter, I thought I might as
	well do the charset= parameter.

[4]	These two settings cascade down through the configuration file.  You
	can set it server wide and override it at the host, directory or
	file levels.

[5]	Technically, per content handler.  The built-in handlers for
	GLV-1.12556 include a directory handler, a file handler (so you can
	reference individual files not in the main diretory) and
	userdirectories.

Link to individual message.

John Cowan <cowan (a) ccil.org>

On Wed, Dec 2, 2020 at 6:53 PM Sean Conner <sean at conman.org> wrote:


> [2]     No default.  If not set, the lang paramter for text/* MIME types
>         will not be set.
>

I can't find any documentation on a lang= parameter.  Not that you need
any; most MIME-type processors don't pay attention to required vs. optional
vs. unknown parameters.


John Cowan          http://vrici.lojban.org/~cowan        cowan at ccil.org
Your worships will perhaps be thinking that it is an easy thing
to blow up a dog? [Or] to write a book?
    --Don Quixote, Introduction

Link to individual message.

Sean Conner <sean (a) conman.org>

It was thus said that the Great John Cowan once stated:
> On Wed, Dec 2, 2020 at 6:53 PM Sean Conner <sean at conman.org> wrote:
> 
> > [2]     No default.  If not set, the lang paramter for text/* MIME types
> >         will not be set.
> 
> I can't find any documentation on a lang= parameter.  Not that you need
> any; most MIME-type processors don't pay attention to required vs. optional
> vs. unknown parameters.

  It's mentioned in the Gemini specification section 5.2 for text/gemini.  I
perhaps was a bit too broad setting it for all text types (and it's an easy
fix to just restrict the lang parameter to just text/gemini in my case).  It
probably won't hurt other text/* types as consumers may just ignore the
lang= parameter.

  -spc

Link to individual message.

colecmac@protonmail.com <colecmac (a) protonmail.com>

This is super cool! Nice idea, and good use of Unicode and the chess.com
API. The chess icons are kinda of thin in my terminal, but that's on me I
guess.

> PS: and yes, it does mean I managed to use SNI to host several domain
> on the same server.

How did you do this? I've seen some general SNI proxies that would probably
work, but I'm interested in your specific setup.


Cheers,
makeworld

Link to individual message.

Sean Conner <sean (a) conman.org>

It was thus said that the Great colecmac at protonmail.com once stated:
> > PS: and yes, it does mean I managed to use SNI to host several domain
> > on the same server.
> 
> How did you do this? I've seen some general SNI proxies that would probably
> work, but I'm interested in your specific setup.

  My server [1] uses libtls [2] and to support multiple hosts, you need to
assign multiple cert/key pairs per interface.  you first call
tls_config_set_keypair_file() for the first cert/key, then call
tls_config_add_keypair_file() for each additional cert/key you want to
support.  I expect it to be similar to other TLS libraries out there.

  -spc

[1]	https://github.com/spc476/GLV-1.12556

[2]	From the LibreSSL distribution

Link to individual message.

CΓ΄me Chilliet <come (a) chilliet.eu>

Le vendredi 4 d?cembre 2020, 22:42:29 CET colecmac at protonmail.com a ?crit :
> > PS: and yes, it does mean I managed to use SNI to host several domain
> > on the same server.
> 
> How did you do this? I've seen some general SNI proxies that would probably
> work, but I'm interested in your specific setup.

I used the SNI_server_certs of the SSL context of the PHP stream, instead 
of the local_cert/local_key pair.
Sadly this option is not documented in the PHP documentation but I?ve 
found information about it on the web.

For each domain you need to cat the cert and the key together in a unique 
pem file, and then in SNI_server_certs you pass an array with domains as 
key and certificate path as value.

You can read my code here: gemini://code.lanterne.chilliet.eu/
The SNI bit is in 
gemini://code.lanterne.chilliet.eu/vendor/mcmic/gemini-server/src/Server.php

C?me

Link to individual message.

---

Previous Thread: *Curated* list of servers?

Next Thread: [ANN] Garden Gnome Society!