3 unstable releases

0.2.0 Sep 20, 2024
0.1.1 Sep 22, 2023
0.1.0 Sep 21, 2023

#832 in Data structures

Download history 4/week @ 2024-10-07 10/week @ 2024-10-14 11/week @ 2024-11-04 1/week @ 2024-11-18 4/week @ 2024-12-09

126 downloads per month
Used in bitboard64

MIT/Apache

31KB
591 lines

chesspos

Useful structs and constants for representing chess board positions.

Position

The main point of this library is the Position struct, which represents a position on a chess board.

use chesspos::prelude::*;

// each position is defined as a const,
// and can be referred to like this:
let a4 = A4;

// the Position struct has various methods
// useful for chess programming
assert_eq!(B4, a4.right().unwrap()); // get the position to the right of A4
assert!(a4.left().is_none()); // no position to the left of A4

Rank & File

There's also a Rank and a File enum, which is useful for traversal and iteration.

use chesspos::prelude::*;

assert_eq!(File::G.iter().collect(), vec![G1, G2, G3, G4, G5, G6, G7, G8]);
assert_eq!(Rank::Two.iter().collect(), vec![A2, B2, C2, D2, E2, F2, G2, H2]);

No runtime deps

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy