Skip to content

Commit

Permalink
yupik alphabet
Browse files Browse the repository at this point in the history
  • Loading branch information
andy-k committed Nov 9, 2023
1 parent b4e78f0 commit 79d61e9
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 3 deletions.
29 changes: 29 additions & 0 deletions src/alphabet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,35 @@ pub fn make_spanish_alphabet<'a>() -> Alphabet<'a> {
})
}

// TODO: find citeable source
// https://discord.com/channels/741321677828522035/778469677588283403/1171937313224392704
pub fn make_yupik_alphabet<'a>() -> Alphabet<'a> {
Alphabet::new_static(StaticAlphabet {
tiles: &[
tile!("?", "?", 2, 0, 0),
tile!("A", "a", 17, 1, 1),
tile!("C", "c", 2, 6, 0),
tile!("E", "e", 6, 1, 1),
tile!("G", "g", 5, 2, 0),
tile!("I", "i", 9, 1, 1),
tile!("K", "k", 5, 2, 0),
tile!("L", "l", 8, 1, 0),
tile!("M", "m", 4, 4, 0),
tile!("N", "n", 8, 1, 0),
tile!("P", "p", 1, 8, 0),
tile!("Q", "q", 4, 4, 0),
tile!("R", "r", 6, 1, 0),
tile!("S", "s", 1, 8, 0),
tile!("T", "t", 8, 1, 0),
tile!("U", "u", 12, 1, 1),
tile!("V", "v", 1, 10, 0),
tile!("W", "w", 1, 10, 0),
tile!("Y", "y", 2, 6, 0),
],
..Default::default()
})
}

pub struct AlphabetReader<'a> {
supported_tiles: Box<[(u8, &'a [u8])]>,
by_first_byte: [Option<(usize, usize)>; 256],
Expand Down
32 changes: 32 additions & 0 deletions src/game_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -451,3 +451,35 @@ pub fn make_jumbled_spanish_game_config<'a>() -> GameConfig<'a> {
exchange_tile_limit: 1,
})
}

#[allow(dead_code)]
pub fn make_yupik_game_config<'a>() -> GameConfig<'a> {
GameConfig::Static(StaticGameConfig {
game_rules: GameRules::Classic,
alphabet: alphabet::make_yupik_alphabet(),
board_layout: board_layout::make_standard_board_layout(),
rack_size: 7,
num_players: 2,
num_passes_to_end: 0,
challenges_are_passes: false,
num_zeros_to_end: 6,
zeros_can_end_empty_board: true,
exchange_tile_limit: 7,
})
}

#[allow(dead_code)]
pub fn make_jumbled_yupik_game_config<'a>() -> GameConfig<'a> {
GameConfig::Static(StaticGameConfig {
game_rules: GameRules::Jumbled,
alphabet: alphabet::make_yupik_alphabet(),
board_layout: board_layout::make_standard_board_layout(),
rack_size: 7,
num_players: 2,
num_passes_to_end: 0,
challenges_are_passes: false,
num_zeros_to_end: 6,
zeros_can_end_empty_board: true,
exchange_tile_limit: 7,
})
}
4 changes: 3 additions & 1 deletion src/main_build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ fn main() -> error::Returns<()> {
generate kad file containing alpha dawg
english-kwg-dawg CSW21.txt outfile.dwg
generate dawg-only file
(english can also be catalan, french, german, norwegian, polish, spanish)"
(english can also be catalan, french, german, norwegian, polish, spanish,
yupik)"
);
Ok(())
} else if args[1] == "auto" {
Expand All @@ -246,6 +247,7 @@ fn main() -> error::Returns<()> {
|| do_lang(&args, "norwegian", alphabet::make_norwegian_alphabet)?
|| do_lang(&args, "polish", alphabet::make_polish_alphabet)?
|| do_lang(&args, "spanish", alphabet::make_spanish_alphabet)?
|| do_lang(&args, "yupik", alphabet::make_yupik_alphabet)?
{
} else {
return Err("invalid argument".into());
Expand Down
8 changes: 7 additions & 1 deletion src/main_leave.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ fn main() -> error::Returns<()> {
english-generate summary.csv leaves.csv
generate leaves (with smoothing)
(english can also be catalan, french, german, norwegian, polish, spanish,
super-english, super-catalan)
yupik, super-english, super-catalan)
jumbled-english-autoplay NWL18.kad leave0.klv leave1.klv 1000
(all also take jumbled- prefix, including jumbled-super-;
note that jumbled autoplay requires .kad instead of .kwg)"
Expand Down Expand Up @@ -182,6 +182,12 @@ fn main() -> error::Returns<()> {
"jumbled-spanish",
game_config::make_jumbled_spanish_game_config,
)?
|| do_lang(&args, "yupik", game_config::make_yupik_game_config)?
|| do_lang(
&args,
"jumbled-yupik",
game_config::make_jumbled_yupik_game_config,
)?
{
} else {
return Err("invalid argument".into());
Expand Down
4 changes: 3 additions & 1 deletion src/main_read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,8 @@ fn main() -> error::Returns<()> {
read .ort (format subject to change)
english-make-q2-ort something.csv something.ort num_buckets
generate .ort with the given num_buckets (ideally prime eg 5297687)
(english can also be catalan, french, german, norwegian, polish, spanish)
(english can also be catalan, french, german, norwegian, polish, spanish,
yupik)
quackle-make-superleaves english.klv superleaves
read klv/klv2 file, save quackle superleaves (english/french)
quackle-superleaves superleaves something.csv
Expand All @@ -639,6 +640,7 @@ fn main() -> error::Returns<()> {
|| do_lang(&args, "norwegian", alphabet::make_norwegian_alphabet)?
|| do_lang(&args, "polish", alphabet::make_polish_alphabet)?
|| do_lang(&args, "spanish", alphabet::make_spanish_alphabet)?
|| do_lang(&args, "yupik", alphabet::make_yupik_alphabet)?
{
} else if args[1] == "quackle-make-superleaves" {
let reader = &KwgReader {};
Expand Down

0 comments on commit 79d61e9

Please sign in to comment.