Crate gobblet

source ·
Expand description

Rust Gobblet Library

This is a library for management Gobblet game.

Example

This places black piece on B2 and white piece on C3 from hands.

use gobblet::{Action, Color, Game, Piece, Size, Square};

let mut game = Game::new();

assert_eq!(game.turn(), Color::Black);
game.execute(Action::PlaceFromHand {index: 0, to: Square::B2});
assert_eq!(game.turn(), Color::White);
game.execute(Action::PlaceFromHand {index: 0, to: Square::C3});

assert_eq!(game.board().get_top(Square::B2), Some(Piece::new(Color::Black, Size::Big)));
assert_eq!(game.board().get_top(Square::C3), Some(Piece::new(Color::White, Size::Big)));

Structs

A simple bitboard. You can work with this using bitwise operators.
A representation of a Gobblet board.
Manages board, hands, turn, and result of the game.
Represents player’s hand.
Represents the piece that includes color and size.
Represents the set of piece. This is used like a stack.

Enums

Represents actions that can be executed in the game.
A representation of piece/player color.
Errors that may occur during working with a board.
Represents the size of piece.
Represents a square on the board.
Represents the progress or result of the game.