Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
A chess TUI implementation (github.com/thomas-mauran)
115 points by kdheepak on Dec 6, 2023 | hide | past | favorite | 46 comments


Various TUI modes were implemented in the ICS protocol for online chess.

  telnet freechess.org 5000
still works.


This is the coolest thing ever! it's a bit hard to play because black/white is not so easy to distinguish but you probably get used to it. (I lost cause I mixed up my knight with my opponents)


You can use many compatible graphical interfaces.

I remember using WinBoard (in Windows) or XBoard (in Linux) around 1998 or 1999 with to play chess on FICS after the novelty of the telnet experience wore off.


Honest question, is there any open source non-subscription based no-frill virtual chess board on Android that allows you to simply play chess offline against human or AI, in the same spirit as VLC on Android?


Lichess is fully open source and the best chess platform right now, online or offline.


lichess is open source and has an android app



Great, thanks for the suggestion.

Apparently, Lichess has 'Over the board' feature that allows you to play with your friend offline, nice!


It also has a pretty good chess clock if you have a physical board but want to play timed.


It also lets you play an engine (stockfish) running on your phone. I play offline on planes all the time.


Written in Scala I believe which makes me love it even more (Scala fan here!).


Vouching for this, best chess app ever. Also offers a website!


Chess (Chess program and FICS client) https://f-droid.org/packages/jwtc.android.chess/

JustChess (Chess for one or two players) https://f-droid.org/packages/com.alaskalinuxuser.justchess/


Not open source but chess.com app is brilliant, it's a freemium model - you can play for free - but they just keep trying to sell you tip and tutorials.

Also seems to have all the grand masters on there as players, Magnus ignored my request for a game though.


Hey, I have my own chess with a textual UI which allows you to play against several beginner-level chess AI opponents:

- Maia chess (https://maiachess.com), the human-like chess engine based on neural networks,

- several of neural networks by Dietrich Kappe (https://github.com/dkappe/leela-chess-weights/releases),

- and handicapped Stockfish (https://stockfishchess.org).

The whole thing is at https://github.com/magv/bchess, and can be installed with just 'pip install bchess'.


Looks good! In case anyone else wonders (first thing I wanted to know), UCI (to talk to engines and online chess) is in the to-do, not yet implemented.


There is a perfectly fine UCI crate available already, so it shouldn't take the author too too long. Unless they intend on implementing it themselves of course. But it's not a terribly complicated protocol either.


Borland Pascal 7 had a chess engine implementation in the EXAMPLES directory. There were two frontends in the same directory: one used OWL to provide a graphical interface in Windows, the other one was for MS-DOS (character-based) using the Turbo Vision library, and it was pretty awesome!


It has always bothered me that there are no Unicode code points for the left/right halves of chess pieces, which would enable a nearly square board using two characters per square.

This is a nice solution, but it makes for a rather big board.


Behold, DEC double-width mode:

    echo -e '\033#6♔♕♖♗♘♙♚♛♜♝♞♟'
(best viewed in xterm)


This gets the correct aspect ratio but the glyphs (on my terminal) look stretched :(


You can be clever and use half-blocks: ♘


What's a half-block and how do I use one?


Sorry, that didn't render. They're U+258C and U+2590. So you put them on either side and each square is rendered across 3 cells, and the 2 outer cells are half-blocks shared with the adjacent squares.

https://en.wikipedia.org/wiki/Block_Elements



What is a chess TUI, please? I play chess for decades but never heard of it.


Ok, it seems to be a "text-based user interface", https://en.wikipedia.org/wiki/Text-based_user_interface


It's wild to me how many people writing native software opt to sandbox everything with docker these days


As a user I love it, I use a mix of Windows, Linux and MacOS machines and when I see docker I know that it will "just werk" regardless of which one I'm using at the moment


conversely, I am using OpenBSD, I see docker, I know that I am in for a long night untangling a docker file.


It’s just a distribution mechanism that users like. The page details other ways to install, including native methods. The container is at the top just because it will be the first thing many people will want to try.


I don't think I've ever liked the experience of running Docker commands; I think its benefit is the sandboxed environment so the developer has fewer platform variables they need to worry about. I think flatpak is a more user friendly distribution mechanism. But, again, sandboxing really shouldn't be necessary with a Rust TUI application; there really shouldn't be much in the way of platform-specific code in there except maybe the ncurses library


Commit 592de110d15c55512f8254b38051e3a61853eb82 looks weird. I don't have the time to read the code, but mod 9 instead of mod 8 in a chess-related program looks like the off-by-one has just been "fixed" in the wrong place.


Could be the newline


I find when learning a language, reading the code for a problem that you already know the rules (or the shape of) really helps.

I think this is probably good project for simply reading the code to learn


See other chess in text mode - https://github.com/ligurio/awesome-ttygames


Great work! Thank you for sharing this.


I think you should not highlight all the possible moves.


Is it using sixels?


Just standard character drawing blocks. Like how Teletext (if you remember that?) used to do graphics

https://github.com/thomas-mauran/chess-tui/blob/592de110d15c...


Looks like my old C64 chess game


what's TUI? T for text?


Or sometimes Terminal, I've seen them used interchangeably though I find “Text” is more common.

Usually TUI is used in a way that implies not just a basic command line interface: something like a GUI (buttons, dialogs, navigable lists, frames, interactive text editing, etc) just drawn using “text” elements so it works via a terminal console. I've seen some people refer to almost any CLI or REPL as a TUI but while they match the words of the acronym (they are user interfaces based on text) I think this is incorrect and TUI refers to a more specific sub-set of text-based interfaces.

See https://en.wikipedia.org/wiki/Text-based_user_interface for more references.


Terminal (command line) User Interface

Yes. Text


this is the most performant chess TUI implementation I've ever used


This is probably one of the most egregious "in rust" projects I've seen. Should I care about the performance improvements over something like Python in a program where I'm going to spend 99.999% of the time thinking? Should I be concerned about memory safety in other chess implementations written in C? The only thing Rust seems to add over Python or Go for things like this is making it harder to hack.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: