Rock,
Paper,
Scissors,
}
use Action::{Paper, Rock, Scissors};
impl Ord for Action {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
match (self, other) {
(Rock, Paper) | (Paper, Scissors) | (Scissors, Rock) => Ordering::Less,
(Rock, Rock) | (Paper, Paper) | (Scissors, Scissors) => Ordering::Equal,
(Rock, Scissors) | (Paper, Rock) | (Scissors, Paper) => Ordering::Greater,
}
}
}
нет, он антитранзитивен
Обсуждают сегодня