Giter VIP home page Giter VIP logo

pong-cli's Introduction

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

pong-cli's People

Contributors

noah2610 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pong-cli's Issues

suggestion: use tui-rs to reduce flashing

First off, cool game! I have a thing for nice terminal games. I recommend in addition to using crossterm, you try using the canvas feature in tui-rs. I've found it completely removes all screen flashing when rendering new frames.

Add color

Add some colors / text styling to the game! Should be optional, toggleable in the settings file.

Add text styling

Similarly to colors, add text styling for all rendered characters (bold, italic, underline, etc.).

Read settings config file from user-space

After the crate was installed (with cargo install or other), the user should have the option to place (and maybe automatically dump) the settings file at a fitting location (~/.config/pong-cli, ~/.pong-cli).
The settings file should probably not be in the ron format; maybe in the toml format?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.