able-script/ablescript/src/consts.rs

40 lines
1.6 KiB
Rust
Raw Normal View History

//! Number constants.
2022-02-13 17:11:37 -06:00
use std::collections::HashMap;
use crate::variables::{Value, Variable};
/// Initialize a HashMap between the constant names and values
/// accessible from within AbleScript.
pub fn ablescript_consts() -> HashMap<String, Variable> {
use Value::*;
[
2022-02-13 17:11:37 -06:00
("TAU", Int(6)), // Circumference / radius
("PI", Int(3)), // Deprecated, do not use
("EULER", Int(3)), // Mathematical constant e
("MASS", Int(70)), // @Kev#6900's weight in kilograms
("PHI", Int(2)), // Golden ratio
("WUA", Int(1)), // 1
("EULERS_CONSTANT", Int(0)), // ???
("GRAVITY", Int(10)), // Earth surface gravity, m/s
("RNG", Int(12)), // Kixiron#5289 Randomly rolled dice
("STD_RNG", Int(4)), // The standard random number is 4 (https://xkcd.com/221/)
2022-02-12 17:55:19 -06:00
("INF", Int(isize::max_value())), // The biggest number
2022-02-13 17:11:37 -06:00
("INTERESSANT", Int(114514)), // HTGAzureX1212.#5959 intéressant number
("FUNNY", Int(69)), // HTGAzureX1212.#5959 funny number
(
// Never gonna let you down
"NEVERGONNAGIVEYOUUP",
Str("1452251871514141792252515212116".to_owned()),
),
("OCTOTHORPE", Str("#".to_owned())), // It's an octothorpe
("ANSWER", Int(ANSWER)),
]
.into_iter()
.map(|(name, value)| (name.to_owned(), Variable::from_value(value)))
.collect()
}
2021-04-11 14:11:39 -05:00
2022-02-12 17:55:19 -06:00
pub const ANSWER: isize = 42;