💾 Archived View for spool-five.com › gemlog › 2024-06-07-gemini_chess.gmi captured on 2024-06-16 at 12:02:14. Gemini links have been rewritten to link to archived content

View Raw

More Information

-=-=-=-=-=-=-

Gemini Chess

I've had a go at making a two-player chess game for Gemini. If you want to try it out it is available at the link below. There is also a version of wordle there, though I made this before I realised that there is already a much better wordle clone available on gemini, Wordo.

I was able to make these thanks to the Space Age gemini server, which is written in clojure and allows for fairly straight-forward development of these kinds of applications for gemini.

Chess & Wordle

Wordo

Space Age gemini server

By coincidence, as I was finishing this up Rob's Gemini Capsule posted about retiring their 'chess over gemini' service. This was the first time that I had heard of that game! I was happy to see that we had both made similar design choices, such as including protable game notation (PGN), etc. I'm sure my version won't be able to fill the hole that is left there, but it is nice to see how the universe works sometimes (one gemini chess closes, another opens!). This was also my first time coming across Rob's blog, which I highly recommend (some great journal-like entries with photos).

Rob's Gemini Capsule post about closure of chess

Reflections

This was my first time trying to make a gemini cgi-style app. In gernal I found it quite simple and easy to reason about, once I got the hang of how the protocol worked. In my case, the app state is all managed via a sqlite database. I'm not sure how others do this.

I only code as a hobby, so I can't comment too much on the deeper questions around how the protocol works, but my own sense was that clojure, or any language that is more on the 'funcitonal' side, worked well for a gemini approach to state. At the end of each request, the state is sort of 'cleared', meaning that the functions and design can't be too dependent on side effects or stateful data, which is exactly how you're supposed to treat functional programming anyway.

Some things that I did feel were lacking (or that were messy in my case) were things like ui components. When working with html, people using clojure can use 'hiccup', which is a nice data-oriented way of expressing and manipulating html documents. In this case, I had a lot of 'string/concat' functions when it came to the UI and formatting the data at the user end.

I felt that there were certain repeating patterns in relation to user input and handling effects that it would be nice if they could be abstracted away. Gary Johnson (the author of Space Age) indicates that there is potential to use 'middleware'-like scripts as wrappers for the main scripts. I didn't look into this as much as I wanted to, but there could be some solutions here for developing a more elegant, clojure-like approach to handling effects and commen patterns like registering users.

This was primarily a learning experience for me, so my approach to writing the code was mainly just trying to find something that 'worked'. At some point I'll definitely have to go back an clean up a lot of the code.

I am also sure that there are likely a lot of bugs and missing features with regard to the chess. To be honest, I haven't played chess myself since I was young! So, any feedback/suggestions are more than welcome!

Gemlog