• rosmax_1337 5 hours ago

    Why reinvent a graphical interface in the terminal? If we are playing chess in the terminal, we are likely happy to accept abstractions and such. You could use normal letters for the different pieces, perhaps using lowercase for black and uppercase for white. Even the "grid" could be an optional setting, placing a slight emphasis on user skill in being able to visualize the grid on their own.

        A B C D E F G H
      8 r n b q k b n r
      7 p p p p p p p p
      6
      5
      4
      3
      2 P P P P P P P P
      1 R N B Q K B N R
    
    This to me feels more like truly playing chess in the terminal. Add a non-interactive session mode, for example "chesst game123 view" to produce a view of the game, and "chesst game123 e2 e4" to move the pawn infront of white king two squares up. Naturally moving a piece can by default also print the new board state, after the opponents move. Implicitly prompting you to move again, or to just leave the terminal and do something else.
    • taeric 5 hours ago

      I'd assume you'd just use the unicode chess symbols, nowadays? (https://en.wikipedia.org/wiki/Chess_symbols_in_Unicode)

      I'd also assume people would use https://en.wikipedia.org/wiki/Algebraic_notation_(chess) for the notation. No need to say "e2 e4" if "e4" is already non-ambiguous. Plus side for learning this notation is it can help read old games.

      • krishnasangeeth 4 hours ago

        There was some trouble in scaling unicode text within the layout. Unfortunately increasing `font-size` is not trivial within the context of terminal. There are some ways around this , but i figured out that it's far more easier to render chess pieces as pixel images using `rich-pixels` [1]

        [1] https://github.com/darrenburns/rich-pixels

        • taeric 4 hours ago

          That makes a ton of sense. Kudos on tackling a lot of issues in making this!

        • rosmax_1337 5 hours ago

          I think the unicode chess symbols are not quite in the spirit of terminal applications. It is also more intuitive to move the rook using algebraic notation, if the rook is denoted by r, rather than "♜". But certainly, viewing the board using unicode symbols is a very reasonable user setting, but I would err that it would not be default.

          And "e2 e4" contains technically superflous information, yes. The application should be able to parse the most minimal algebraic notation possible, but also more verbose commands.

          • taeric 5 hours ago

            Totally fair. It also reminded me that emacs has a chess package. Because of course it does. :D

        • shagie 5 hours ago

          > Even the "grid" could be an optional setting, placing a slight emphasis on user skill in being able to visualize the grid on their own.

          As a starting point (and only a few because this gets long and tedious to show) - it uses tput ( https://man7.org/linux/man-pages/man1/tput.1p.html https://www.gnu.org/software/termutils/manual/termutils-2.0/... )

              #!/bin/bash
              
              echo    '  A B C D E F G H'
              echo -n '1 '
              tput mr
              echo -n 'r'
              tput me
              echo -n ' n '
              tput mr
              echo -n 'b'
              tput me
              echo
          • rosmax_1337 5 hours ago

            I'm going to assume this produces a grid. Once again, we are reinventing a graphical user interface. If we wanted all this, why wouldn't we open firefox and go to chess.com or lichess.org. Or even something that runs natively on your computer, perhaps even producing lavish and beautiful 2d or 3d rendering of the game.

          • krishnasangeeth 4 hours ago

            I did start initially with something like this, but then i sort of stumbled upon `chess-tui` and I was mostly trying to see if i can build something similar.

            The first version was chess notation based movement. I got some initial feedback that it's probably not very useful. I still understand that most people would probably use chess.com or some other chess app if they want a full blown graphical experience and with terminal there are many limitations at play which would limit a full experience for such folks. But there is hopefully more interesting things that can be added to this such as your suggestions for viewing games that will make it more useful.

            • lynx23 2 hours ago

              I wrote cboard, a simple text-mode frontnend for playing with UCI engine, which basically works the way you describe. It is part of the Haskell chessIO package.

              https://github.com/mlang/chessIO

              And Emacs Chess (also known as chess.el) has a "chess-plain" board variant which is configurable down to which letters should be used. Borders are also optional, all configurable.

              • HL33tibCe7 4 hours ago

                > Why reinvent a graphical interface in the terminal?

                Pattern recognition

              • kazinator 3 hours ago

                In the FOSS world there is a protocol between chess-like board games and user interfaces, the primary examples of which are the XBoard GUI client, and the GNU Chess engine.

                If you write an XBoard-compatible terminal client, then it can just work with GNU chess and other back ends.

                • Brajeshwar 5 hours ago

                  The unbearable pixel graphics on such a large display make it unplayable. It's a nice one, though. I think I should shrink the size of my terminal window. Or can you make everything smaller? Need Keyboard support.

                  • krishnasangeeth 3 hours ago

                    > I think I should shrink the size of my terminal window.Or can you make everything smaller?

                    So the board shrinks down as you reduce the size of window. Currently there is an issue in the chess pieces scaling down in size if we reduce the size of terminal. Showing images properly is quite tricky in terminal, hope to get to it sometime later this week.

                    > Need Keyboard support.

                    That's also something on my mind. Do you have any specific scenario in mind. I was thinking of hotkeys or chess notation as input.

                  • sa-code 3 hours ago

                    Slightly relevant, here's a version of Wordle in the terminal built using go:

                    https://github.com/sa-/wordle-tui

                  • pwnOrbitals 4 hours ago

                    On that same note, is there also an app to play chess wrong in my terminal ?

                    • krishnasangeeth 4 hours ago

                      Aaah, I wish i could edit that title now.

                    • TheBlight 5 hours ago

                      Cool but you could always play ASCII chess in your terminal by telnetting into FICS.

                      • pixelmania 4 hours ago

                        Fantastic work on Termichess!

                        • FergusArgyll 5 hours ago

                          The opening in your demo is disgusting, way to ruin a Sicilian....

                          Very cool program though :)

                          • krishnasangeeth 4 hours ago

                            Chess speaks for itself :-D

                            • qsort 5 hours ago

                              Oh come on, usual HN. It can't be that ba...

                              > 2. Qf3

                              Well maybe it was jus...

                              > 4. Nh3

                              I see...

                              • mtlmtlmtlmtl 4 hours ago

                                At least it's not the Alapin(2. c3). As a sicilian player from the black side this is like half my games now and I'm considering switching to some other defence because it's boring me to death. Not sure what I'd go for though, feels like the sicilian is the only non-dubious defence to e4 to offer real fighting positions. Caro-kann is passive, French is pretty passive unless they play Nc3 and you get the Winaver, Scandi is a snoozefest, and the Petrov is frankly disgusting in its lack of ambition. Two Knight's defence is very fun if they play Ng5 or d4 but now everyone's playing d3 to make the game as boring as possible.

                                I guess I'm stuck with the Sicilian. If anyone knows a way to make the Alapin wild and tactical as black, I'm listening.

                                • FergusArgyll 4 hours ago

                                  I play e5, Archangel (6 Bc5) is fun in the spanish, ofc you're taking the risk of white playing an italian and you falling asleep...

                                  • mtlmtlmtlmtl 3 hours ago

                                    Archangel does indeed look like a fun one. Lots of good options in the Ruy Lopez really. The Open Spanish and the Marshall gambit can be a lot of fun too.

                                    Funnily enough I actually play the Italian as white, but I don't play the boring c3 d3 lines. After 3. Bc4 Bc5 I play 0-0 and on Nf6 play d4. exd4 e5 transposes to the Max Lange and Bxd4 Nxd4 Nxd4 Bg5 gets into the Italian gambit which is very sharp. My main issue is that on 4. 0-0 d6, d4 doesn't really offer much. I've been playing a "deferred Evans" with b4 and getting some fun positions that way though. I'm also working on learning the minutiae of 2. Bc4 so I never have play a Petrov ever again...

                            • anthk 5 hours ago

                              gnuchess did it before, and better. Also, telnet freshchess.org 5000. FICS rules.