Skip to main content

fair/
lib.rs

1//! # provably fair baccarat
2//!
3//! Deterministically simulates a game of baccarat. Assumes an inifinite amount of card decks.
4
5/*
6use std::env;
7use std::error::Error; use std::fs;
8*/
9// use std::process;
10
11mod card;
12pub mod games;
13mod rng;
14mod wasm;
15
16pub use rng::{ProvablyFairConfig, ProvablyFairRNG};
17
18/*
19pub fn simulate<T>(
20    game: &str,
21    client_seed: &str,
22    server_seed: &str,
23    nonce: u64,
24    opts: Option<T>,
25) -> Result<String, String> {
26    let config = ProvablyFairConfig::new(client_seed, server_seed, nonce);
27    let result_str = match game {
28        "baccarat" => {
29            let result = games::baccarat::simulate(config);
30            format!("{}", result)
31        }
32        "dice" => {
33            let result = games::dice::simulate(config);
34            format!("{}", result)
35        }
36        "limbo" => {
37            let result = games::limbo::simulate(config);
38            format!("{}", result)
39        }
40        "hilo" => {
41            let result = games::hilo::simulate(config);
42            format!("{}", result)
43        }
44        "blackjack" => {
45            let result = games::blackjack::simulate(config);
46            format!("{}", result)
47        }
48        "diamond_poker" => {
49            let result = games::diamond_poker::simulate(config);
50            format!("{}", result)
51        }
52        "plinko" => {
53            let result = games::plinko::simulate(config, None);
54            format!("{}", result)
55        }
56        _ => {
57            return Err(format!("{} is not a supported game.", game));
58        }
59    };
60    Ok(result_str)
61}
62*/