import util;
import game;
import core.stdc.signal;
import std.c.stdlib;

abstract class Output
{
	void command(char c);
}

class NilOutput : Output
{
	override void command(char c) {}
}

class StdOutput : Output
{
	// Handle SIGINT: force abort and exit.
	static this()
	{
		signal(SIGINT, &sigint);
	}
	extern(C) static void sigint(int) {
		write("A");
		stdout.flush();
		exit(0);
	}

	override void command(char c)
	{
		// TODO: optimize redundancy.
		write(c);
		stdout.flush();
	}
}
