How to Play Chess in Your Linux Terminal (With Multiplayer Support … – MUO – MakeUseOf

Chess is the original 4X RPGgiving you command of territory and an army, together with a mission to explore and expand across the board, exploit your enemy's weakness, and then exterminate your opponent.

While it's simple to play online chess in a browser, you can also stage a two-player chess game in your terminal, either with an opponent in the same room or via SSH, meaning your opponent could be anywhere in the worldor beyond. Here's how.

Chess is one of the greatest games of all time, with a history going back to the 6th Century Gupta Empire in India. Although the rules have been refined over time, chess has remained popular due to its accessibility, and the cerebral challenge of pitting one person's skills against another.

If you've never played chess before, don't fret; you can easily learn to play Chess on your phone.

Traditionally, chess is a two-player game, played using a physical board with 64 squares, and two armies of 16 pieces.

Before the advent of the internet, if you wanted to play chess with someone who wasn't in the same room as you, each player would have to have their own chess board and communicate their moves via a letter telegram, phone, or a message in the newspaper.

Today, you can use mobile apps to instantly join chess games, or open a web browser and join one of the many online chess sessions on dedicated sites.

But mobile apps can be costly, and not everyone has a computer with a web browseror even a graphical desktop.

With Gambit, you can create a chess game in your terminal, and play with the person sitting next to you. Alternatively, you can serve or join a game over SSH, meaning you can play instantly against anyone in the world.

Gambit is written in Google's Go language, so before you start, make sure that you have Go installed on your Linux system.

If your distro supports Snap, the easiest way to install Go is with:

With Go installed, you can install Gambit with:

This command will install the Gambit binary to ~/go/bin/gambit.

You can make the binary accessible from any terminal location by creating a symbolic link with the ln command:

You can then start Gambit with:

Alternatively, you can install Gambit by cloning its GitHub repository:

Then, use the cd command to navigate to the new directory:

Finally, start Gambit with:

If you're a fan of Snap packages, you can install Gambit with the snap command as follows:

If you've read this far, it's probably safe to say that you know at least the basics of how to play chess.

The game starts as soon as you open Gambit, and you'll see a chess board, complete with representations of the chess pieces in either white or black with a white outline.

When it's your turn to move, click on a piece. You'll see a colored dot representing the spaces your piece can move to. Click on one to move your piece.

Alternatively, if your machine doesn't have a mouse, you can use the keyboard to type out the square the piece you want to move is on, then type out the square onto which you want to move the piece.

The only minor gripe we have with playing chess this way is that the chessboard squares are all black, rather than black and white. This can make it a little difficult to easily visualize paths for your pieces.

If you're playing against an opponent on the same computer, you can press the Ctrl + F key combo to flip the board around to give them a better view of the action.

But if you're sitting next to someone, it's probably just as easy, and slightly more satisfying, to break out a real chess board and set up the pieces. It's in playing remote players that Gambit comes into its own.

Secure Shell (SSH) is a protocol used to connect to remote devices securely, and with it, you can host a chess game with Gambit and have other players connect to it.

Before you start, you'll need to create an SSH key. It's not in the documentation, but Gambit will reject keys created with the RSA algorithm. You'll need to use the newer ECDSA algorithm with a minimum key size of 256 bits to host a chess game over SSH with Gambit.

On the host machine, enter:

Choose whether you want to use a password, and then hit Enter. You can find your new key pair in the "~/.ssh/" directory.

If you're playing against an opponent on a different network, the host will need to open port 53531 on their router and forward connections to the host machine's IP address. This requires you to have some basic knowledge about port forwarding on a router.

To start the Gambit server, enter:

Gambit will start the server on port 53531, and players can connect to the game with:

...where room_name is a name picked by the first player to join.

Back on the host machine, you won't find a chessboard in your existing terminal window. Open a second window or tab, then enter:

You can now play a game against your opponent.

If you know your opponent and schedule regular matches against them, Gambit makes it super easy to create or connect to a match.

If your friends don't play chess, don't use Linux, or if you just don't have any friends, you can play solitaire in your terminal instead!

Read more here:
How to Play Chess in Your Linux Terminal (With Multiplayer Support ... - MUO - MakeUseOf

Related Posts

Comments are closed.