mahjong_core/
ui.rs

1use crate::{Dragon, Flower, Season, Suit, Tile, Wind};
2
3pub fn format_to_emoji(tile: &Tile) -> String {
4    match tile {
5        Tile::Suit(tile) => match tile.suit {
6            Suit::Bamboo => format!("🎋{}", tile.value),
7            Suit::Characters => format!("✨{}", tile.value),
8            Suit::Dots => format!("💠{}", tile.value),
9        },
10        Tile::Wind(tile) => match tile.value {
11            Wind::East => "🍃EA".to_string(),
12            Wind::North => "🍃NO".to_string(),
13            Wind::South => "🍃SO".to_string(),
14            Wind::West => "🍃WE".to_string(),
15        },
16        Tile::Dragon(tile) => match tile.value {
17            Dragon::Green => "🐉GR".to_string(),
18            Dragon::Red => "🐉RE".to_string(),
19            Dragon::White => "🐉WH".to_string(),
20        },
21        Tile::Flower(tile) => match tile.value {
22            Flower::Bamboo => "💮BA".to_string(),
23            Flower::Chrysanthemum => "💮CH".to_string(),
24            Flower::Orchid => "💮OR".to_string(),
25            Flower::Plum => "💮PL".to_string(),
26        },
27        Tile::Season(tile) => match tile.value {
28            Season::Autumn => "🌞AU".to_string(),
29            Season::Spring => "🌞SP".to_string(),
30            Season::Summer => "🌞SU".to_string(),
31            Season::Winter => "🌞WI".to_string(),
32        },
33    }
34}