-
Notifications
You must be signed in to change notification settings - Fork 519
/
lib.rs
29 lines (27 loc) · 855 Bytes
/
lib.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#[derive(PartialEq, Eq, Debug)]
pub enum Bucket {
One,
Two,
}
/// A struct to hold your results in.
#[derive(PartialEq, Eq, Debug)]
pub struct BucketStats {
/// The total number of "moves" it should take to reach the desired number of liters, including
/// the first fill.
pub moves: u8,
/// Which bucket should end up with the desired number of liters? (Either "one" or "two")
pub goal_bucket: Bucket,
/// How many liters are left in the other bucket?
pub other_bucket: u8,
}
/// Solve the bucket problem
pub fn solve(
capacity_1: u8,
capacity_2: u8,
goal: u8,
start_bucket: &Bucket,
) -> Option<BucketStats> {
todo!(
"Given one bucket of capacity {capacity_1}, another of capacity {capacity_2}, starting with {start_bucket:?}, find pours to reach {goal}, or None if impossible"
);
}