#pong #game #cli

bin+lib pong-cli

Play pong from the command-line!

2 stable releases

✓ Uses Rust 2018 edition

1.0.1 Oct 27, 2019
1.0.0 Oct 26, 2019

#13 in Games

MIT license

69KB
2K SLoC

Pong CLI

A CLI pong clone.
Uses the crossterm and specs crates.



Asciicasts

Description

Play pong from your terminal!
Play against a ball-chasing AI opponent, locally against another player,
or let two AIs fight it out!
Everything is configurable, see the Configuration section.

Installation

From crates.io

You'll need to have cargo and rust version 1.38.0 or higher installed.
Download, build, and install from crates.io with ...

cargo install pong-cli

Then you should be able to run the game from anywhere with ...

pong-cli

Binaries

Binaries for Linux and Windows are available from the releases GitHub page.
From there, simply download the .zip file for your platform,
extract the archive and run the executable:

  • pong-cli for Linux (from terminal),
    or double-click the PongCLI.desktop file from your GUI file-manager
  • pong-cli.exe for Windows

From source

To build the game from source, you'll need to clone the repo and compile the game using cargo.
You'll need to have rust version 1.38.0 or higher installed.

Clone the repository with ...

git clone https://github.com/Noah2610/pong-cli

cd into the project's root with cd pong-cli,
Then you can build and run the game with ...

cargo run --release

You can also install it with cargo, so it is available everywhere from the command-line ...

cargo install --path .

Configuration

Settings are read from a .ron file at one of the following locations (checked in order):

  • ./settings.ron
  • ./pong-cli.ron
  • $HOME/.pong-cli.ron
  • $HOME/.config/pong-cli/settings.ron (for Linux),
    $HOME/AppData/Roaming/pong-cli/settings.ron (for Windows)
    $HOME/Library/Preferences/pong-cli/settings.ron (for MacOS)

To start, copy the default settings.ron file to one of these locations.

Once the settings.ron file is in place, you can edit it as you wish.
The file itself is commented, so just open it to see all available settings.

Download with `curl` on Linux

On Linux, you can enter the following (if you have curl installed), to
automatically create the proper directory/directories and download the latest settings.ron file:

mkdir -p ~/.config/pong-cli
curl https://raw.githubusercontent.com/Noah2610/pong-cli/master/settings.ron > ~/.config/pong-cli/settings.ron

Features

Feature Default? Description
random YES Enables randomization for ball spawning directions.
See settings.ron file for configuration.
style YES Adds configurable color and text styling (bold, underline, etc.) to the game.
See settings.ron file for configuration.
nightly no Enables specs/nightly feature for debug/development purposes.

Use --no-default-features to disable all features when building with cargo build/run.

License

MIT License

Dependencies

~2.6–3.5MB
~69K SLoC