organicomplex 0.7.0

Interactive complex-valued cellular automaton on 2D and 3D grids in search of that stuff - emergence, open-endedness, organicity etc.
pub mod automaton;

use crate::{
	base::PrependErrorString,
	fontset::{
		FontContext,
		Fontset
	},
	lingua::Lingua,
	master::{
		Context,
		Ether
	},
	precalc::Precalc,
	state::State,
	sys::System
};

pub fn play(sys: &mut System) -> Result<(), String> {
	let precalc = Precalc::init(sys)?;

	let font_context = FontContext::init().pre_err("cannot init font context")?;
	let fontset = Fontset::load(&font_context).pre_err("cannot load fonts")?;

	let mut state = State::load_or_new_default(sys).pre_err("cannot load state or create a new one")?;

	loop {
		let mut lingua = Lingua::new(sys);

		let mut ether = Ether::new(sys, &mut state).pre_err("cannot init ether from state")?;

		let mut ctx = Context{sys, precalc: &precalc, fontset: &fontset, lingua: &mut lingua, state: &mut state, ether: &mut ether};

		automaton::play(&mut ctx).pre_err("cannot play automaton")?;

		if ether.quit {
			break;
		}
	}

	state.save().pre_err("cannot save state to autosave")?;

    Ok(())
}