Skip to content

Commit

Permalink
Merge pull request #205 from TruncateGame/main
Browse files Browse the repository at this point in the history
Second production release March 11 2024
  • Loading branch information
bglw authored Mar 11, 2024
2 parents 3dbeb7f + 9bf57ad commit ca7b350
Show file tree
Hide file tree
Showing 10 changed files with 373 additions and 73 deletions.
3 changes: 0 additions & 3 deletions truncate_client/src/app_inner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,6 @@ pub fn render(outer: &mut OuterApplication, ui: &mut egui::Ui, current_time: Dur
.board;
let header = HeaderType::Summary {
title: format!("Regular Puzzle"),
sentinel: '•',
attempt: None,
};
let puzzle_game = SinglePlayerState::new(
Expand All @@ -434,7 +433,6 @@ pub fn render(outer: &mut OuterApplication, ui: &mut egui::Ui, current_time: Dur
.board;
let header = HeaderType::Summary {
title: format!("Easy Puzzle"),
sentinel: '•',
attempt: None,
};
let puzzle_game = SinglePlayerState::new(
Expand Down Expand Up @@ -481,7 +479,6 @@ pub fn render(outer: &mut OuterApplication, ui: &mut egui::Ui, current_time: Dur
.board;
let header = HeaderType::Summary {
title: format!("Truncate Puzzle"),
sentinel: '•',
attempt: None,
};
let puzzle_game = SinglePlayerState::new(
Expand Down
2 changes: 1 addition & 1 deletion truncate_client/src/lil_bits/result_modal/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ impl DailySplashGraph {
(
best_win.moves,
format!(
"Won! Best score {} move{}",
"Won! Personal best: {} move{}",
best_win.moves,
if best_win.moves == 1 { "" } else { "s" }
),
Expand Down
2 changes: 1 addition & 1 deletion truncate_client/src/lil_bits/result_modal/msg_mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ impl ShareMessageMock {
format!("Truncate Town Day #{day}\n{first_win_message}")
} else {
format!(
"Truncate Town Day #{day}\n{first_win_message}\nBest score: {} move{}",
"Truncate Town Day #{day}\n{first_win_message}\nPersonal best: {} move{}",
best_win.moves,
plur(best_win.moves)
)
Expand Down
7 changes: 1 addition & 6 deletions truncate_client/src/regions/active_game.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ pub enum HeaderType {
Timers,
Summary {
title: String,
sentinel: char,
attempt: Option<usize>,
},
None,
Expand Down Expand Up @@ -275,11 +274,7 @@ impl ActiveGame {

ui.add_space(item_spacing);
}
HeaderType::Summary {
title,
sentinel,
attempt,
} => {
HeaderType::Summary { title, attempt } => {
let summary_height = 50.0;
let summary_width = ui.available_width();
let (rect, _) = ui.allocate_exact_size(
Expand Down
26 changes: 14 additions & 12 deletions truncate_client/src/utils/daily.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub const DAILY_PUZZLE_DAY_ZERO: usize = 19751;
pub struct SeedNote {
pub rerolls: usize,
pub best_player: usize,
pub board_generation: u32,
pub verification: String,
}

Expand All @@ -55,19 +56,22 @@ pub fn get_raw_daily_puzzle(day: u32) -> (BoardSeed, Option<(HumanStarts, SeedNo
let loaded_notes: NotesFile =
serde_yaml::from_slice(SEED_NOTES).expect("Seed notes should match the spec");

let mut board_seed = BoardSeed::new(day).day(day);

let mut info = None;

let notes = loaded_notes.notes.get(&day);

if let Some(notes) = notes {
let mut board_seed = BoardSeed::new_with_generation(notes.board_generation, day).day(day);

for _ in 0..notes.rerolls {
board_seed.external_reroll();
}
info = Some((notes.best_player == 0, notes.clone()));
}
let info = Some((notes.best_player == 0, notes.clone()));

(board_seed, info)
} else {
let board_seed = BoardSeed::new(day).day(day);

(board_seed, info)
(board_seed, None)
}
}

pub fn get_playable_daily_puzzle(
Expand All @@ -79,8 +83,7 @@ pub fn get_playable_daily_puzzle(
) -> SinglePlayerState {
let (board_seed, info) = get_raw_daily_puzzle(day);

let header_title = format!("Truncate Town Day #{day}");
let mut header_sentinel = if info.is_some() { '★' } else { '*' };
let mut header_sentinel = if info.is_some() { '#' } else { '?' };
let human_starts = info.as_ref().map(|(h, _)| *h).unwrap_or(true);

let board = generate_board(board_seed.clone())
Expand All @@ -100,13 +103,12 @@ pub fn get_playable_daily_puzzle(
if let Some((_, notes)) = info {
let verification = get_game_verification(&game_state.game);
if verification != notes.verification {
header_sentinel = '¤';
header_sentinel = '!';
}
}

game_state.header = HeaderType::Summary {
title: header_title,
sentinel: header_sentinel,
title: format!("Truncate Town Day {header_sentinel}{day}"),
attempt: Some(0),
};

Expand Down
29 changes: 20 additions & 9 deletions truncate_core/src/generation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,26 @@ pub struct BoardParams {
// Do not modify any numbered generations.
// Add a new generation number with new parameters.
// Updating an existing generation will break puzzle URLs.
const BOARD_GENERATIONS: [BoardParams; 1] = [BoardParams {
land_dimensions: [10, 10],
dispersion: [5.0, 5.0],
isolation: 2.0,
maximum_town_density: 0.2,
maximum_town_distance: 0.15,
island_influence: 0.0,
minimum_choke: 3,
}];
const BOARD_GENERATIONS: [BoardParams; 2] = [
BoardParams {
land_dimensions: [10, 10],
dispersion: [5.0, 5.0],
isolation: 2.0,
maximum_town_density: 0.2,
maximum_town_distance: 0.15,
island_influence: 0.0,
minimum_choke: 3,
},
BoardParams {
land_dimensions: [9, 10],
dispersion: [5.0, 5.0],
isolation: 2.0,
maximum_town_density: 0.2,
maximum_town_distance: 0.15,
island_influence: 0.0,
minimum_choke: 3,
},
];

impl BoardParams {
pub fn generation(gen: u32) -> Self {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,29 @@ source: truncate_core/src/generation.rs
expression: "format!(\"Board 1 from {bare_seed_1}:\\n{board_one}\\n\\nrerolled to {bare_seed_2}:\\n{board_two}\")"
---
Board 1 from 12345:
~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ |1 ~~
~~ ~~ ~~ __ __ __ ~~ __ __ #1 __ ~~
~~ ~~ ~~ __ __ __ ~~ __ __ __ __ ~~
~~ ~~ ~~ __ __ __ ~~ __ __ __ __ ~~
~~ ~~ ~~ __ __ __ __ __ __ __ __ ~~
~~ ~~ ~~ __ __ __ __ __ __ __ __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