#![allow(dead_code)]
#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(unused_parens)]
#![allow(non_snake_case)]

#![allow(warnings)]

/*
	Possibilities:
		674274182400 = 52 * 51 * 50 * 49 * 48 * 47 * 46
		6.74e+11
		
		674274182400i64
		
		What percentage are:	
			Royal Flush:
			...
			Straight:
			
	Before Venues Built:
		3118 75200 = 52 * 51 * 50 * 49 * 48
		3.12e8
		
		e_note = "{:.6e}".format (311875200)	
		
	After Venues Built:
		2542 51200 = 50 * 49 * 48 * 47 * 46
		2.54e8
		
		10000000
*/


use std::time::{ Duration, Instant };


extern crate cliclack;
extern crate comfy_table;
extern crate serde;
extern crate serde_json;



use cliclack::{ intro, outro };
use cliclack::select;
use comfy_table::Table;

mod deck;
mod _furniture;
mod _Medallion;

mod venue_distribution;

mod stages;


/*
	Ploys:
		low mid connectors from [4, 5] to [7,8]
			-> straight is unbeatable sometimes
		
		low mid jerseyed connectors like 5, 6
			5 card flush (every) 17.32 rivers
			
			-> flush is the zero sometimes
			-> straight is the zero sometimes
			
			
		pocket pairs:
			3 or 4 	every 5.21 Rivers
			3 		every 5.45 Rivers
		
			
			
	Eclecticism
		mid connectors is [4, 5] to [10,J]
			because can form entire straight on both directions.
		
*/


fn grid_01 () {
    let mut table = Table::new();
    table.set_header (vec![
		"Header1", 
		"Header2", 
		"Header3"
	])
	.add_row (vec![
		"This is a text",
		"This is another text",
		"This is the third text",
	])
	.add_row (vec![
		"This is another text",
		"Now\nadd some\nmulti line stuff",
		"This is awesome",
	]);

    println!("{table}");
}

fn suggestions () -> Result<(&'static str, &'static str), Box<dyn std::error::Error>> {
	// grid_01 ();
	
	intro ("create-my-app")?;
	
	let mut stage = "";
	let mut play = "";
	
	stage = select ("Stage")
		.item ("Venue", "Venue", "")
		.item ("Flop", "Flop", "")
		.item ("Turn", "Turn", "")
		.item ("River", "River", "")
		.interact()?;
	
	/*
		Perhaps:
			Venue -> Pockets
			
				Flop	Turn	River
				
		
		https://crates.io/crates/tabled
		https://crates.io/crates/cliclack
	*/
	if (stage == "Venue") {
		play = select ("Play")
			.item ("Venue :: 2 Leagued :: to 3 or 4", "Venue :: 2 Leagued :: to 3 or 4", "")
			.item ("Venue :: 2 Teamed :: to exactly 5 Team", "Venue :: 2 Teamed :: to exactly 5 Team", "")
			.item ("Venue :: 2 Teamed :: to exactly 5 Team", "Venue :: 2 Teamed :: to exactly 5 Team", "")
			.interact()?;
	}
	
	if (stage == "Flop") {
		play = select ("Play")
			.item (
				"Flop :: 4 Teamed :: to exactly 5 Team", 
				"Flop :: 4 Teamed :: to exactly 5 Team", 
				""
			)
			.item (
				"Flop :: 4 Sequential :: to Straight", 
				"Flop :: 4 Sequential :: to Straight", 
				""
			)
			.interact()?;
	}
	
	
	
	outro ("You're all set!")?;
	
	println!("You picked: {}", play);

    Ok ((stage, play))
}


fn main () -> Result<(), Box<dyn std::error::Error>> {
	let (stage, play) = suggestions()?;
	let start = Instant::now ();
	
	/*
		[Leagues, Equals, Equities]
		[Teams, Jerseys]		
		[Elevators]
		[ Different Leagues ]
	*/
	
	
	if (stage == "Venue") {
		/*
			[Leagues]
		*/
		if (play == "Venue :: 2 Leagued :: to 3 or 4") {
			// Duration: 44.224770978s
			stages::venue::pair::achieves_three_or_four_of_a_kind ();	
		}
		
		/*
			[Teams]
		*/
		if (play == "Venue :: 2 Teamed :: to exactly 5 Team") {
			stages::venue::team_duet_to_quintet::play ();
		}
		
		
		/*
			[ Different Leagues ]
		*/
		if (play == "Venue :: 2 Different Leagues :: Both Pair") {
			stages::venue::different::makes_two_pair_on_unpaired_desk ();
		}
	}
	
	if (stage == "Flop") {
		
		/*
			[Teams]
		*/
		if (play == "Flop :: 4 Teamed :: to exactly 5 Team") {
			stages::flop::four_jerseyed::makes_flush ();
		}
		
		/*	
			[Slides]
		*/
		if (play == "Flop :: 4 Sequential :: to Straight") {
			stages::flop::four_sequential::makes_straight ();
		}
	}
	
	let duration = start.elapsed ();
	println! ("Duration: {:?}", duration);
	
	Ok (())
}



fn main_v1 () {
	
	// venue_distribution::run ();
	// players_01::role_has_five_card_flush ();	
	


	return;
}