Crate nimlib

Source
Expand description

githubcrates-iodocs-rs

NimLib is a Rust library for Nim games: calculate nimbers and possible moves

NimLib is work-in-progress at the moment.
Features such as Poker-Nim (coin pools) are not yet implemented.

Modules§

moves
Code for handling moves.
This module contains code for handling moves in Nim games, such as calculating the resulting position after a move is applied, determining if a move is valid, and generating all possible moves for a given position.
nimbers
The inner workings of the nimber calculation algorithm.

Structs§

NimGame
A Nim game
NimRule
A rule for a Nim game.
This struct specifies a set of possible moves for a player.
Nimber
A nimber.
Simply wraps a u64.
PlaceAction
A move which places coins onto a stack from the player’s pool
Stack
Represents a stack of coins; specifically its height.
Simply wraps a u64.
TakeAction
A move which takes coins from a stack

Enums§

NimAction
A Nim move, generally represented, not connected to a position, or a specific game.
NimSplit
Represents a possible split of a stack into two non-empty stacks in a NimAction::Take move
Split
Specifies if a player may/must split a stack into two non-empty stacks after taking coins
TakeSize
Specifies the number of coins that can be taken from a stack in a single move according to a rule.