/*
	let mut this_deck = crate::deck::make_array ();
	
	let venue_1 = crate::deck::remove_card (&mut this_deck, &["8", "D"]).unwrap ();
	let venue_2 = crate::deck::remove_card (&mut this_deck, &["9", "D"]).unwrap ();
*/

/*
	match deck::remove_card (&mut this_deck, & ["7", "C"]) {
		Some (card) => println! ("Removed card: {:?}", card),
		None => println! ("Card not found"),
	}
*/

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
}


/*
	This retrieves the card index from the deck.
*/
/*
	use super::deck;
	let index = deck::retrieve_card_index (& this_deck, rank, suit);
*/
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()
}

/*
	let character_card_1 = deck::remove_card (&mut this_deck, "A", "C").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)) // Remove and return the card
    } else {
        None // Card not found
    }
}