1use colored::*;
2use core::fmt::Display;
3pub enum RunResult {
4 Accept,
5 Reject,
6 ExceededTime,
7 ExceededMemory,
8}
9
10impl Display for RunResult {
11 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12 match self {
13 RunResult::Accept => write!(f, "{}", "Accepted!".bright_blue().bold()),
14 RunResult::Reject => write!(f, "{}", "Rejected!".bright_blue().bold()),
15 RunResult::ExceededTime => write!(
16 f,
17 "{}",
18 "Turing Machine exceeded the maximum number of iterations!"
19 .red()
20 .bold()
21 ),
22 RunResult::ExceededMemory => {
23 write!(
24 f,
25 "{}",
26 "Turing Machine exceeded the maximum amount of memory!"
27 .red()
28 .bold()
29 )
30 }
31 }
32 }
33}