-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
expose only the main game loop, hide all implementation
- Loading branch information
Christoph Lohrmann
committed
Oct 14, 2024
1 parent
98caf89
commit 25745b4
Showing
2 changed files
with
59 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,5 @@ | ||
use kniffel::engine; | ||
use std::collections::HashMap; | ||
|
||
fn main() { | ||
let mut dice = engine::Dice::new(); | ||
|
||
let players = vec!["chris", "katja"]; | ||
|
||
let mut score_sheets: HashMap<String, engine::ScoreSheet> = HashMap::new(); | ||
for player in players { | ||
score_sheets.insert(String::from(player), engine::ScoreSheet::new()); | ||
} | ||
|
||
for turn in 1..14 { | ||
println!("Start of turn {turn}. Score so far"); | ||
engine::print_all_score_sheets(&score_sheets); | ||
println!(); | ||
|
||
for (player, sheet_ref) in &mut score_sheets { | ||
println!("turn {turn} for player {player}"); | ||
engine::play_turn(&mut dice, sheet_ref); | ||
println!(""); | ||
} | ||
} | ||
println!("final result:"); | ||
engine::print_all_score_sheets(&mut score_sheets); | ||
engine::play_game(); | ||
} |