1use std::ops::{Add, Div, Mul, Sub};
8use rand::prelude::*;
9
10#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
11#[repr(u8)] pub enum Megabool {
14 True,
16
17 False,
19
20 Yesnt,
22
23 Neither,
25
26 Both,
28
29 Maybe,
31
32 ObliviouslyTrue,
34
35 ObliviouslyFalse,
37
38 ItDepends,
40
41 Oscillating,
43
44 ItsComplicated,
46
47 DoubleTrue,
49}
50impl Megabool {
51 pub fn let_me_choose() -> Self {
53 let n: u8 = rand::thread_rng().gen_range(0..=2);
54 match n {
55 0 => Self::False,
56 1 => Self::True,
57 2 => Self::Both,
58
59 _ => Self::Neither,
60 }
61 }
62}
63impl From<bool> for Megabool {
64 fn from(value: bool) -> Self {
65 match value {
66 true => Self::True,
67 false => Self::False,
68 }
69 }
70}
71impl Add for Megabool {
72 type Output = Self;
73
74 fn add(self, rhs: Self) -> Self::Output {
75 match (self, rhs) {
76 (Self::True, Self::True) => Self::DoubleTrue,
77 _ => Self::Neither,
78 }
79 }
80}
81impl Sub for Megabool {
82 type Output = Self;
83
84 fn sub(self, rhs: Self) -> Self::Output {
85 match (self, rhs) {
86 (Self::DoubleTrue, Self::True) => Self::True,
87 _ => Self::Neither,
88 }
89 }
90}
91impl Mul for Megabool {
92 type Output = Self;
93
94 fn mul(self, rhs: Self) -> Self::Output {
95 match (self, rhs) {
96 (Self::True, Self::True) => Self::ObliviouslyTrue,
97 (Self::False, Self::False) => Self::ObliviouslyFalse,
98 _ => Self::Neither,
99 }
100 }
101}
102impl Div for Megabool {
103 type Output = Self;
104
105 fn div(self, rhs: Self) -> Self::Output {
106 match (self, rhs) {
107 (Self::ObliviouslyTrue, Self::True) => Self::True,
108 (Self::ObliviouslyFalse, Self::False) => Self::False,
109 _ => Self::Neither,
110 }
111 }
112}