fours 0.1.0

Four in a row in your terminal, with three levels of opponent.
Documentation
use miette::Diagnostic;
use std::io;
use thiserror::Error;

/// Something that went wrong between the game and the terminal.
#[derive(Debug, Error, Diagnostic)]
#[non_exhaustive]
pub enum AppError {
    /// The terminal could not be switched to the mode the game needs.
    #[error("the terminal could not be prepared for the game")]
    #[diagnostic(
        code(fours::terminal_setup),
        help("Start the game from an interactive terminal rather than from a pipe or a script.")
    )]
    TerminalSetup(#[source] io::Error),

    /// A frame could not be written to the terminal.
    #[error("the game could not be drawn")]
    #[diagnostic(code(fours::draw))]
    Draw(#[source] io::Error),

    /// A key press could not be read.
    #[error("the game could not read your input")]
    #[diagnostic(code(fours::input))]
    Input(#[source] io::Error),

    /// The terminal could not be switched back to its original mode.
    #[error("the terminal could not be restored")]
    #[diagnostic(
        code(fours::terminal_restore),
        help("Run `reset` if your terminal behaves oddly after this.")
    )]
    TerminalRestore(#[source] io::Error),
}