use crate::traits::RollResult;
pub type BinaryOperator = fn(left: &RollResult, right: &RollResult) -> RollResult;
pub fn sum(left: &RollResult, right: &RollResult) -> RollResult {
(*left) + (*right)
}
pub fn difference(left: &RollResult, right: &RollResult) -> RollResult {
(*left) - (*right)
}
pub fn multiply(left: &RollResult, right: &RollResult) -> RollResult {
(*left) * (*right)
}
pub fn divide(left: &RollResult, right: &RollResult) -> RollResult {
(*left) / (*right)
}
pub fn advantage(left: &RollResult, right: &RollResult) -> RollResult {
if *left > *right {
*left
} else {
*right
}
}
pub fn disadvantage(left: &RollResult, right: &RollResult) -> RollResult {
if *left < *right {
*left
} else {
*right
}
}
pub fn compare(left: &RollResult, right: &RollResult) -> RollResult {
if *left > *right {
1
} else if *left == *right {
0
} else {
-1
}
}
pub fn greater_than(left: &RollResult, right: &RollResult) -> RollResult {
if *left > *right {
1
} else {
0
}
}
pub fn greater_than_or_equal_to(left: &RollResult, right: &RollResult) -> RollResult {
if *left >= *right {
1
} else {
0
}
}
pub fn less_than(left: &RollResult, right: &RollResult) -> RollResult {
if *left > *right {
1
} else {
0
}
}
pub fn less_than_or_equal_to(left: &RollResult, right: &RollResult) -> RollResult {
if *left >= *right {
1
} else {
0
}
}
pub fn equal_to(left: &RollResult, right: &RollResult) -> RollResult {
if *left == *right {
1
} else {
0
}
}