Crates.io | gyges |
lib.rs | gyges |
version | 1.0.2 |
source | src |
created_at | 2024-08-01 01:41:13.935922 |
updated_at | 2024-08-02 19:41:41.082766 |
description | A library for the board game Gygès. |
homepage | |
repository | https://github.com/Beck-Bjella/Gyges |
max_upload_size | |
id | 1321467 |
size | 2,263,428 |
A library for the board game Gygès.
Gygès is an abstract strategy game for two players. The object of Gygès is to move a piece to your opponent's last row. The catch is that no one owns the pieces. You can only move a piece in the row nearest you. Pieces are made up of 1, 2, or 3 rings; this number is also the number of spaces they must move. If a piece lands on another piece, it can move the number of spaces equal to that piece's number of rings. It can also displace that piece to any open space.
Check out the game on Board Game Arena: Gygès.
This is specifically a library for the game Gygès, not the engine to play the game. You can check out the engine here.
Documentation and the Crates.io page.
You can add this crate to your project by adding the following to your Cargo.toml
file:
[dependencies]
gyges = "1.0.1"
This project has only been tested on a x86_64 architecture, and no guarantees are made for other platforms.
This is one specific starting position built into the library. Other constant board positions can be loaded as well.
use gyges::board::*;
// Load Board
let board = BoardState::from(STARTING_BOARD);
Boards can be created using this notation, as shown below. Each set of 6 numbers represents a row on the board, starting from your side of the board and going left to right. The orientation of the board is subjective and is based on how the board is inputted.
use gyges::board::*;
// Load Board
let board = BoardState::from("321123/000000/000000/000000/000000/321123");
Move generation is done in a two-step process. You must generate a RawMoveList
and then extract the moves from that list into a Vec<Move>
. This is done to improve efficiency and reduce unnecessary processing. When making a move, the make_move
function will return a copy of the board with the move applied.
use gyges::board::*;
use gyges::moves::*;
// Load Board
let mut board = BoardState::from(STARTING_BOARD);
// Define a player
let player = Player::One;
// Generate moves
let mut movelist = unsafe{ valid_moves(&mut board, player) }; // Create a MoveList
let moves = movelist.moves(&mut board); // Extract the moves
// Make a move
board.make_move(&moves[0]);
This project and its formating was inspired by the incridible rust chess program Pleco.
Contributions welcome! If you'd like to contribute, please open a pull request. Feedback is greatly appreciated, along with reporting issues or suggesting improvements.
This project is released under the GNU General Public License v3.0. Please review and comply with the terms of the license when using or distributing the project.