Cli usage:
Convert 10 meters to inches Convert 10 hours to minutes
cargo run -- -u 10 m in
cargo run -- -u 10 hr min
Run Dice Game Simulation 100 times Dice Game Simulation will save results to ./output/simulations/%YYYY-%MM-%DD%h_%m_%s.txt
cargo run -- -n 100
With logs
cargo run -- -n 100 -v
Results output to custom filepath
cargo run -- -n 100 -o ./hello_world.txt
If the program is ended early with Ctrl^C... The output file will be modified such that the early termination is noted and the filename includes the number of simulations completed.
cargo run -- -n 100 -o ./hello_world.txt
ls ./hello*
>>> hello_world_early_exit_992_simulations_completed.txt
I came across a video of a Jane Street Mock Interview, and was curious to implement it in Rust. The purpose of the problem wasn't to show off DSA, but to demonstrate talking through a code exercise with an interviewer.
Given the facts, write a program to correctly answer the following queries. ''' example facts:
- m = 3.28 ft
- ft = 12 in
- hr = 60 min
- min = 60 sec example queries:
- 2m = ? in ---> answer = 78.72
- 13 in = ? m ---> answer = 0.330 (roughly)
- 13 in = ? hr ---> "not convertible!" '''
#####Dice Game Strategy Simulation
Implementation of part 1 of this problem on Jane Street's
youtube.
######Strategy 1:
Roll if the value of the current die-result is less than the sum of the
expected values of all die results greater than the current result for
the current turn.
######Strategy 2:
Roll if the value is less than 20.
####Unit Conversion Class Diagram
To run tests
cargo test