WIP
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use rand::rngs::StdRng;
|
||||
use rand::SeedableRng;
|
||||
use cagire::forth::{Dictionary, Forth, Rng, StepContext, Value, Variables};
|
||||
use cagire::forth::{Dictionary, EmissionCounter, Forth, Rng, StepContext, Value, Variables};
|
||||
use std::collections::HashMap;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
@@ -46,6 +46,14 @@ pub fn forth_seeded(seed: u64) -> Forth {
|
||||
Forth::new(new_vars(), new_dict(), seeded_rng(seed))
|
||||
}
|
||||
|
||||
pub fn new_emission_counter() -> EmissionCounter {
|
||||
Arc::new(Mutex::new(0))
|
||||
}
|
||||
|
||||
pub fn forth_with_counter(counter: EmissionCounter) -> Forth {
|
||||
Forth::new_with_counter(new_vars(), new_dict(), seeded_rng(42), counter)
|
||||
}
|
||||
|
||||
pub fn run(script: &str) -> Forth {
|
||||
let f = forth();
|
||||
f.evaluate(script, &default_ctx()).unwrap();
|
||||
|
||||
Reference in New Issue
Block a user