organicomplex 0.7.0

Interactive complex-valued cellular automaton on 2D and 3D grids in search of that stuff - emergence, open-endedness, organicity etc.
/*
 * OrganiComplex
 *
 * Interactive complex-valued cellular automaton on 2D and 3D grids in search
 * of that stuff - emergence, open-endedness, organicity etc.
 * 
 * https://sunkware.org/organicomplex
 * 
 * mediator@sunkware.org
 * 
 * Copyright (c) 2026 Sunkware
 * 
 * OrganiComplex is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * OrganiComplex is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with OrganiComplex. If not, see <https://www.gnu.org/licenses/>.
 */

// extern crate image;
extern crate sdl2;
extern crate serde;
extern crate serde_json;
extern crate rand;
extern crate rand_xoshiro;
extern crate rayon;

use std::process;

mod base;
mod fontset;
mod lingua;
mod master;
mod play;
mod precalc;
mod state;
mod sys;

use base::PrependErrorString;

fn run() -> Result<(), String> {
	let mut sys = sys::System::init().pre_err("cannot init system")?;
	play::play(&mut sys).pre_err("cannot play")?;
    sys.shut().pre_err("cannot shut system")?;
	Ok(())
}

fn main() {
	process::exit(match run() {
		Ok(_) => 0,
		Err(s) => {
			eprintln!("Error: {}", s);
			1
		}
	});
}

// To avoid linker errors ("undefined reference to ...") at cross-compiling from Linux to 32-bit Windows
// Follows https://github.com/rust-lang/rust/issues/79609#issuecomment-1161560324

#[cfg(all(target_os = "windows", target_arch = "x86"))]
#[no_mangle]
pub extern "C" fn _Unwind_Resume() {}

#[cfg(all(target_os = "windows", target_arch = "x86"))]
#[no_mangle]
pub extern "C" fn _Unwind_RaiseException() {}