use super::parser::Parser;
use crate::Direction;
pub(super) fn direction_to_char(direction: Direction, is_box_pushed: bool) -> Option<char> {
match (direction, is_box_pushed) {
(Direction::Left, true) => Some(Parser::UPPER_L),
(Direction::Left, false) => Some(Parser::LOWER_L),
(Direction::Right, true) => Some(Parser::UPPER_R),
(Direction::Right, false) => Some(Parser::LOWER_R),
(Direction::NorthEast, true) => Some(Parser::UPPER_N),
(Direction::NorthEast, false) => Some(Parser::LOWER_N),
(Direction::NorthWest, true) => Some(Parser::UPPER_U),
(Direction::NorthWest, false) => Some(Parser::LOWER_U),
(Direction::SouthEast, true) => Some(Parser::UPPER_D),
(Direction::SouthEast, false) => Some(Parser::LOWER_D),
(Direction::SouthWest, true) => Some(Parser::UPPER_S),
(Direction::SouthWest, false) => Some(Parser::LOWER_S),
_ => None,
}
}
pub(super) fn char_to_direction(move_char: char) -> Option<Direction> {
match move_char {
Parser::UPPER_L | Parser::LOWER_L => Some(Direction::Left),
Parser::UPPER_R | Parser::LOWER_R => Some(Direction::Right),
Parser::UPPER_N | Parser::LOWER_N => Some(Direction::NorthEast),
Parser::UPPER_U | Parser::LOWER_U => Some(Direction::NorthWest),
Parser::UPPER_D | Parser::LOWER_D => Some(Direction::SouthEast),
Parser::UPPER_S | Parser::LOWER_S => Some(Direction::SouthWest),
_ => None,
}
}