tui-snake

Crates.iotui-snake
lib.rstui-snake
version0.1.0
sourcesrc
created_at2021-07-30 14:02:31.042399
updated_at2021-07-30 14:02:31.042399
descriptionTUI implementation of Snake
homepage
repositoryhttps://github.com/NomisIV/tui-snake/
max_upload_size
id429299
size16,587
NomisIV (NomisIV)

documentation

README

It's that snake game...

...but written as a TUI program in rust.

About

This program uses termion for generating escape codes for the graphics. The only other dependency is rand for randomizing the position of the food piece.

The implementation is multithreaded:

  • One thread for getting the inputs (waiting for input is blocking)...
  • ...another thread for the ticks (thread::sleep is also quite blocking)...
  • ...and lastly a main thread responsible for recieving input from both threads.

Communication between the threads is done by using mpsc channels, which I'd never heard of before starting this project, but they proved to be incredibly useful.

Installing

cargo install tui-snake

Running

tui-snake

Currently the program doesn't support any command line options / flags, and the entire terminal is used as a playing field. This might come to change with later versions.

To exit the program while running, press Esc or Ctrl+c.

Commit count: 3

cargo fmt