Skip to main content

Crate indian_rummy_core

Crate indian_rummy_core 

Source

Re-exports§

pub use deck_validation::generate_complete_deck;
pub use deck_validation::generate_complete_deck_with_jokers;
pub use deck_validation::is_complete_deck;
pub use deck_validation::validate_deck_structure;
pub use game::Player;
pub use game::Move;
pub use game::MoveType;
pub use game::MoveResult;
pub use game::IndianRummyGame;
pub use game::SyndicateGame;
pub use game::GameState;

Modules§

deck_validation
game

Structs§

Card
Represents a playing card
CompletedHandResult
Result type for completed hand detection
GameSet
Represents a set of cards (sequence or triplet)

Enums§

Rank
Represents a card rank in Indian Rummy
RummyError
Error types for the Indian Rummy library
SetType
Type of set in Indian Rummy
Suit
Represents a card suit in Indian Rummy

Functions§

calculate_penalty_score
Calculate penalty score for a collection of ungrouped cards Jokers (both literal and designated) do not contribute to the penalty score
card_value
Get the penalty value of a card for scoring purposes Numbered cards (A, 2-9) are worth their face value, face cards (T, J, Q, K) are worth 10
completed_hand_exists
Find a completed hand from a collection of exactly 13 or 14 cards Returns the completed hand and remaining cards if found, None otherwise Returns None for collections with less than 13 or more than 14 cards
find_all_possible_arrangements
Find all possible valid arrangements of a 13-card hand using backtracking algorithm
is_completed_hand
Check if a hand is completed (valid arrangement with at least 2 sequences, 1 life)
is_joker
Check if a card is a joker (either literal joker or designated joker) All cards of the same rank as the designated joker are considered jokers/wildcards
is_life_sequence
Check if a sequence is a life (no jokers allowed)
is_valid_sequence
Check if a sequence is valid (consecutive ranks of same suit)
is_valid_triplet
Check if a triplet is valid (3-4 cards of same rank, different suits)
score
Calculate the minimum penalty score for a hand according to Indian Rummy rules Returns 0 if the hand is completed, otherwise returns the minimum penalty score

Type Aliases§

Deck
Type alias for a deck of cards
Hand
Type alias for a hand of cards