pub mod longest_straight;
pub mod loop_through_stories;
pub fn make_array () -> Vec<[&'static str; 2]> {
let mut cards : Vec<[&str; 2]> = Vec::new ();
for jersey in [ "C", "S", "H", "D" ] {
for talent in [
"A", "K", "Q", "J",
"T", "9", "8", "7",
"6", "5", "4", "3",
"2"
] {
cards.push ([ talent, jersey ]);
}
}
cards
}
pub fn retrieve_card_index (
deck: &Vec<[&str; 2]>,
rank: &str,
suit: &str
) -> usize {
deck.iter()
.position(|&card| card[0] == rank && card[1] == suit)
.unwrap()
}
pub fn remove_card (cards: &mut Vec<[&'static str; 2]>, card_to_remove: &[&str; 2]) -> Option<[&'static str; 2]> {
if let Some(pos) = cards.iter().position(|card| *card == *card_to_remove) {
Some (cards.remove(pos)) } else {
None }
}