fair/
lib.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//! # provably fair baccarat
//!
//! Deterministically simulates a game of baccarat. Assumes an inifinite amount of card decks.

/*
use std::env;
use std::error::Error; use std::fs;
*/
// use std::process;

mod card;
pub mod games;
mod rng;
mod wasm;

pub use rng::{ProvablyFairConfig, ProvablyFairRNG};

/*
pub fn simulate<T>(
    game: &str,
    client_seed: &str,
    server_seed: &str,
    nonce: u64,
    opts: Option<T>,
) -> Result<String, String> {
    let config = ProvablyFairConfig::new(client_seed, server_seed, nonce);
    let result_str = match game {
        "baccarat" => {
            let result = games::baccarat::simulate(config);
            format!("{}", result)
        }
        "dice" => {
            let result = games::dice::simulate(config);
            format!("{}", result)
        }
        "limbo" => {
            let result = games::limbo::simulate(config);
            format!("{}", result)
        }
        "hilo" => {
            let result = games::hilo::simulate(config);
            format!("{}", result)
        }
        "blackjack" => {
            let result = games::blackjack::simulate(config);
            format!("{}", result)
        }
        "diamond_poker" => {
            let result = games::diamond_poker::simulate(config);
            format!("{}", result)
        }
        "plinko" => {
            let result = games::plinko::simulate(config, None);
            format!("{}", result)
        }
        _ => {
            return Err(format!("{} is not a supported game.", game));
        }
    };
    Ok(result_str)
}
*/