Releases: sunsided/river-crossing
Releases · sunsided/river-crossing
0.3.0
This release adds the Wolf, Goat and Cabbage problem to the application.
These two commands are equivalent:
cargo run -- wolf-goat-cabbage
cargo run -- wolf-goat-cabbage --boat 2 --farmers 1 --wolves 1 --goats 1 --cabbage 1
Running them prints a solution like the following:
At t=0; left bank: farmer, wolf, goat and cabbage; right bank: empty
→ farmer and goat cross forward
At t=1; left bank: wolf and cabbage; right bank: farmer and goat
← farmer returns alone
At t=2; left bank: farmer, wolf and cabbage; right bank: goat
→ farmer and cabbage cross forward
At t=3; left bank: wolf; right bank: farmer, goat and cabbage
← farmer and goat return
At t=4; left bank: farmer, wolf and goat; right bank: cabbage
→ farmer and wolf cross forward
At t=5; left bank: goat; right bank: farmer, wolf and cabbage
← farmer returns alone
At t=6; left bank: farmer and goat; right bank: wolf and cabbage
→ farmer and goat cross forward
At t=7; left bank: empty; right bank: farmer, wolf, goat and cabbage
0.2.0
This release adds the Bridge and Torch problem to the application.
These two commands are equivalent:
cargo run -- bridge-and-torch
cargo run -- bridge-and-torch --bridge 2 --torch 15 --person 1 --person 2 --person 5 --person 8
Running them prints a solution like the following:
At 0 minutes: [<1>, <2>, <5>, <8>] on the left, nobody on the right (torch: 15 minutes)
→ [<1>, <2>] cross forward, taking 2 minutes
At 2 minutes: [<5>, <8>] on the left, [<1>, <2>] on the right (torch: 13 minutes)
← [<1>] returns, taking 1 minute
At 3 minutes: [<5>, <8>, <1>] on the left, [<2>] on the right (torch: 12 minutes)
→ [<5>, <8>] cross forward, taking 8 minutes
At 11 minutes: [<1>] on the left, [<2>, <5>, <8>] on the right (torch: 4 minutes)
← [<2>] returns, taking 2 minutes
At 13 minutes: [<1>, <2>] on the left, [<5>, <8>] on the right (torch: 2 minutes)
→ [<1>, <2>] cross forward, taking 2 minutes
At 15 minutes: nobody on the left, [<5>, <8>, <1>, <2>] on the right (torch: 0 minutes)