hext-boards

Crates.iohext-boards
lib.rshext-boards
version0.5.0
created_at2022-12-25 09:04:46.033369+00
updated_at2025-01-17 12:24:02.282431+00
descriptionA small library that renders hexagonal boards with text on the terminal
homepage
repositoryhttps://github.com/odilf/hext-boards/
max_upload_size
id745235
size13,849
(Odilf)

documentation

README

hext-boards

A small library to render hexagonal boards on the terminal.

Example

use hext_boards::HexagonalBoard;

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

let output = board.to_string();

// Also works
println!("{board}");

/* Output is the following:

 /---\     /---\
⟨  b  ⟩---⟨  c  ⟩
 \---⟨  a  ⟩---/
      ⟩---⟨
     ⟨  d  ⟩
      \---/
*/
Commit count: 16

cargo fmt