#terminal #hexagons #ascii

hext-boards

A small library that renders hexagonal boards with text on the terminal

2 releases

0.1.1 Dec 25, 2022
0.1.0 Dec 25, 2022

#1508 in Command line utilities

Custom license

15KB
103 lines

hex-boards

A small library that renders hexagonal boards on the terminal.

Example

use hex_boards::HexagonalBoard;
use nalgebra::vector;

let board = HexagonalBoard::from([
	(vector![0, 0], 'a'),
	(vector![1, 0], 'b'),
	(vector![0, 1], 'c'),
	(vector![-1, -1], 'd'),
]);

let output = format!("{board}");

/* Output is the following:

 /---\     /---\
⟨  b  ⟩---⟨  c  ⟩
 \---⟨  a  ⟩---/
      ⟩---⟨
     ⟨  d  ⟩
      \---/
*/

Dependencies

~3MB
~59K SLoC