CLI game to see how fast you can guess the language of a code block!

Overview

Guess That Lang!

Share Your High Score

CLI game to see how fast you can guess the language of a code block!

If you like the game, please consider giving a !

Game Demo

Code is retrieved from either random repos or random gists on GitHub using any of the top 24* most popular languages from the Stack Overflow 2022 Developer Survey. *VBA is replaced with Dockerfile

The code is then processed in a number of ways to make the experience more enjoyable.

Installation

Using Prebuilt Binaries
  • With Bash
    curl -fsSL "https://bina.egoist.dev/Lioness100/guess-that-lang" | sh

    Using Bina

  • Manual Installation

    Prebuilt binaries are available for Windows, Linux, and macOS and can be found attached to the latest release.

Building From Source

⚠️ Rust 1.63.0 or higher is required to build. Rust can be updated with rustup update.

Install Rust and then run:

cargo install guess-that-lang

Usage

It's strongly recommended to provide a Github personal access token. This will allow the game to make more Github requests before getting ratelimited. Click here to make one (no scopes are required).

⚠️ Resizing the terminal window while playing will cause the game to go a bit wonky.

# Tokens will be stored in a config file so you only need to input them once.
guess-that-lang --token "XXX" # or -t

# Get code from gists rather than repos.
# Repos generally provide better code quality, but gists require less API calls.
guess-that-lang --provider gists # or -p

# Wait 5 seconds after showing the options before starting to reveal code. (Default: 1500)
guess-that-lang --wait 5000 # or -w

# Reveal lines in random order instead of top to bottom. (Default: false)
guess-that-lang --shuffle # or -s

# Theme overrides will be stored in a config file so you only need to input them once.
guess-that-lang --theme dark
guess-that-lang --theme light

Acknowledgements

This game takes heavy inspiration from both guessthiscode and stripcode.

Contributing

I'm a beginner at Rust, so if you see any code that can be improved or have any general ideas, please let me know! Feel free to open an issue or a pull request.

Comments
  • terminal colors on light background are not good

    terminal colors on light background are not good

    Light gray on white is a little rough. I think there may also be some white-on-white. Need to set the code highlight colors to medium luminance by default and/or provide an argument to indicate light vs dark terminal.

    enhancement 
    opened by BartMassey 7
  • Repeating code blocks

    Repeating code blocks

    When playing the game, I often encounter repeated code blocks, especially a lot of Javascript, e.g. a startgame function I get at least once per game, sometimes twice in a row. Is this intended?

    Edit: I did input my GH token

    opened by Sup3Legacy 2
  • fix(terminal): missing return caused mismatched type error

    fix(terminal): missing return caused mismatched type error

    The repository as of 2022-08-14 couldn't be compiled using "cargo build" due to a mismatched type error. Fixed it by adding a missing return statement.

    opened by sanj0 2
  • Will not compile on Linux

    Will not compile on Linux

    Turns out ansi_term::enable_ansi_support() is available only on Windows. Change the imports in terminal.rs to

    use ansi_term::{
        ANSIGenericStrings,
        Color::{self, Fixed, RGB},
    };
    #[cfg(windows)]
    use ansi_term::enable_ansi_support;
    
    opened by BartMassey 1
  • dark_light match statement bug

    dark_light match statement bug

    When running on some machines, this error is shown when running:

    thread 'main' panicked at 'no entry found for key', /home/desktop/.cargo/registry/src/github.com-1ecc6299db9ec823/guess-that-lang-1.0.3/src/terminal.rs:63:20
    

    That trace resolves to here which shows that this function isn't returning a valid string. If the get_theme call is replaced by a string literal of either theme, it works.

    // Both of the following work.
    themes.themes["Monokai Extended"].clone(),
    themes.themes["Monokai Extended Light"].clone(),
    

    The get_theme function is copied from the example in dark-light's README. This error also doesn't appear on my personal machine, so I can't quite debug it.

    https://github.com/rust-lang/rust/issues/28606 - This might be related.

    bug help wanted good first issue 
    opened by Lioness100 1
  • Save custom initial delay

    Save custom initial delay

    Basically the title. Whenever the user requests a custom delay using the --wait flag, this delay gets saved in the config, just like the theme and the GH token. Also a few minor style suggestions.

    opened by Sup3Legacy 1
  • Always map keys to the same language

    Always map keys to the same language

    If you would always map keys to the same language it would remove the extra step of looking down on the options and you could focus on the code. Great game btw :)

    enhancement help wanted good first issue 
    opened by MaximilianGaedig 17
Releases(v1.0.20)
Owner
Typescript enthusiast and professional bunny adorer
null
A block world game engine written in Rust.

About This is the Leafwing Studios' template repo, providing a quick, opinionated base for high-quality Bevy game projects (and libraries). We've shav

null 0 Feb 3, 2022
You have been an apprentice to a powerful sorcerer for as long as you can remember.

You have been an apprentice to a powerful sorcerer for as long as you can remember. However you dream of becoming a rancher, raising animals in your own pen.

null 3 Jun 22, 2022
Managed game servers, matchmaking, and DDoS mitigation that lets you focus on building your game

Managed game servers, matchmaking, and DDoS mitigation that lets you focus on building your game. Home - Docs - Twitter - Discord ?? Features Everythi

Rivet 58 Jun 25, 2023
Solana Game Server is a decentralized game server running on Solana, designed for game developers

Solana Game Server* is the first decentralized Game Server (aka web3 game server) designed for game devs. (Think web3 SDK for game developers as a ser

Tardigrade Life Sciences, Inc 16 Dec 1, 2022
A tetris game I wrote in rust using ncurses. I'm sure that there's a better way to write a tetris game, and the code may be sus, but it techinically works

rustetris A tetris game I wrote in rust using ncurses. I'm sure that there's a better way to write a tetris game, and the code may be sus, but it tech

Eric G 3 Oct 15, 2022
The Big Cheese a webapp wherein you can share recipes with your friends.

The Big Cheese The Big Cheese a webapp wherein you can share recipes with your friends. Contributing Contributions are what make the open source commu

null 3 May 5, 2022
A canvas on which you can draw anything with ease before drawing the pixels on your small hardware display.

embedded-canvas    canvas - a piece of cloth backed or framed as a surface for a painting NOTE: This crate is still in development and may have breaki

Lechev.space 13 Aug 31, 2022
Transform your terminal into an art canvas where you can draw stuff!

Termdraw Turn your terminal into the drawing cavnas of your dream... or not! Installation To install this dream-come-true of a tool simply run cargo i

Enoki 5 Nov 23, 2022
Random utility stuff for bevy for my personal use. You're welcome to use it, too, if you like.

bevy_cleancut Random utility stuff for bevy for my personal use. You're welcome to use it, too, if you like. Stuff It's all in the prelude: use bevy_c

Nathan Stocks 3 Aug 15, 2024
A puzzle game where you eat your own tail to win!

taileater taileater is a puzzle game available for free here: https://szunami.itch.io/taileater This project is built using Rust and Bevy. Assets were

null 25 Dec 20, 2022
Small game where you play a big spider chasing small spiders, written in Rust and Macroquad.

Ludum Dare #49 Compo entry - Procedural Spider Small game where you play a big spider chasing small spiders. Each spider you catch makes you bigger! C

Jakub Arnold 16 Sep 5, 2022
This is an online game in which you program your character and he fights with other players

Game for programmers The goal of this project is to create a simple game for programmers. The essence of the game Each player has his own character th

Danila 1 Dec 10, 2021
An HTML5 game where you are a bumblebee visiting flowers

Bumble Umble Gee Our small family team made a game to compete in the Game Off 2021. In this game you play a bumble-bee visiting flowers in a meadow. G

Alan Falloon 1 Dec 1, 2021
Extreme Bevy is what you end up with by following my tutorial series on how to make a low-latency p2p web game.

Extreme Bevy Extreme Bevy is what you end up with by following my tutorial series on how to make a low-latency p2p web game. There game can be played

Johan Klokkhammer Helsing 39 Jan 5, 2023
🐝 An action-packed game where you play as a missile-dodging, laser-evading, upgradeable bumbly bee.

Beeline The last known specimens of the Andor flower, the flower with the tastiest nectar in the world, are preserved at the Mount Dared fortified mil

plam 4 Oct 6, 2022
vetovoima is an arcade game where you control gravity!

vetovoima vetovoima is an arcade game where you control the gravity! The world is a hollow circle with a star in the center. You're the Yellow Block a

Matias Klemola 6 Oct 4, 2022
Just when you thought Bevy couldn't get more ergonomic, Bvy shows up to change the game.

Just when you thought Bevy couldn't get more ergonomic, Bvy shows up to change the game. Is this a joke? You decide. Does it work? You can bet your As

Carter Anderson 40 Oct 28, 2022
Victorem - easy UDP game server and client framework for creating simple 2D and 3D online game prototype in Rust.

Victorem Easy UDP game server and client framework for creating simple 2D and 3D online game prototype in Rust. Example Cargo.toml [dependencies] vict

Victor Winbringer 27 Jan 7, 2023
2-player game made with Rust and "ggez" engine, based on "Conway's Game of Life"

fight-for-your-life A 2-player game based on the "Conway's Game of Life", made with Rust and the game engine "ggez". Create shapes on the grid that wi

Petros 3 Oct 25, 2021