Struct curses_game_wrapper::GameEnv [] [src]

pub struct GameEnv { /* fields omitted */ }

This is for spawning curses game as child process.

It stores inputs from the game and sends result to AI when its input handler timeouts.

The only usage is

Example

extern crate curses_game_wrapper as cgw;
use cgw::{Reactor, ActionResult, AsciiChar, GameSetting};
use std::time::Duration;
fn main() {
    struct EmptyAI;
    impl Reactor for EmptyAI {
        fn action(&mut self, _screen: ActionResult, _turn: usize) -> Option<Vec<u8>> {
             None
        }
    }
    let gs = GameSetting::new("rogue")
        .env("ROGUEUSER", "EmptyAI")
        .lines(24)
        .columns(80)
        .debug_file("debug.txt")
        .max_loop(10)
        .draw_on(Duration::from_millis(200));
    let game = gs.build();
    let mut ai = EmptyAI { };
    game.play(&mut ai);
}

Methods

impl GameEnv
[src]

[src]

Start process and run AI.