Show HN: Zerorain – Game of binary rain for the terminal

1 month ago 1
█████ ████ █ ███ █ █ ▒ ▒▒ ▒ ▒ ▒ ▒ ▒ ▒▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ░░ ░ ░ ░ ░ ░ ░ ░ ░░ ░░░░░ ░ ░ ░ ░ ░░░░░ ░ ░

Game of binary rain for the terminal. This is the terminal version of 0RA1N. The goal was to provide a gameplay experience as close as possible to the original. Obviously, the terminal requires some adjustments.

Type 0 or 1 to clear digits in falling strains of rain. Clear the digits in sequence to clear the strains. Keep the strains from reaching bottom of screen. Easy. Right?

Made with lots of love in Nim. Fast compilation, small binary, zero dependencies.

ZERORAIN Walkthrough

Click to watch walkthrough

Startup

. . . . . . . . . . . . . . . . . 0RA1N . . . . . [S]tart . . .. . . Seed: 1760231228250249271 . . . . . . . . . . . . .. . . . . 0 .

Gameplay

. . . . .. 1 . 1 1 . 1 . 0 1. 1 . 1 1 0 1 . 1. 0 1 0 0 0 1 1 1 0 . 0 0 10 1 1 0 . 1 1 . 0 0 . .0 0. 0 0 . 0 0 0 0 . 1 0 1 0 0 11 . 0 0 . 0 0 1 0 1 1 1 1 1 1 1 0 0 0. 1 0 0 . 0 . 1 . 0 0 1 01 1 0 0 11 1 0 00 0 0 11 1 . 0 0 0 1 . 1 .1 0 . 0 1 . . 0 .0 . 1 1 . .. . 1 1 . . . . 110 . . .
  • Install Nim: curl https://nim-lang.org/choosenim/init.sh -sSf | sh
  • Clone the repo: git clone https://github.com/maddestlabs/zerorain
  • Compile: nim compile -d:release zerorain.nim
  • Run: ./zerorain

Compilation takes maybe 3 seconds, it's super fast.

zerorain [options] Options: -h, --help Show this help message -v, --version Show version information -s, --seed N Set random seed for reproducible patterns Game Controls: 0, 1 Clear bits in falling strains s Start new game r Restart with same seed (game over only) ESC/q Exit game How to Play: - Binary strains fall from the top - Type the digits in the strains (0 or 1) in order to clear them - Clear all digits in a strain to score points - Game ends when any strain reaches the bottom Scoring: - Points equal the number of bits in cleared strains - Longer strains = more points

To quickly summarize, the reason Nim is used for this:

  • It's both easy and fun to code in. Feels just like Python.
  • Nim is insanely fast at compilation.
  • The binary is small, under 200KB.

Fast compilation is an understatement. It compiles in practically the same amount of time it would take to install an app from apt on Linux.

Included in this repo is a Linux binary built in WSL Ubuntu on Windows.

Read Entire Article