Comment code and remove unnecessary code.
This commit is contained in:
parent
cd8f4319ab
commit
3e2a3c385c
@ -26,6 +26,8 @@ extern crate rand;
|
||||
|
||||
fn main() {
|
||||
let size = 100;
|
||||
|
||||
// initialize the boxes with randomly assigned numbers
|
||||
let mut boxes:Vec<u32> = Vec::with_capacity(size as usize);
|
||||
|
||||
{
|
||||
@ -39,6 +41,7 @@ fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
// have prisoners find their number
|
||||
let mut all_found = true;
|
||||
for i in 0..size
|
||||
{
|
||||
@ -54,10 +57,6 @@ fn main() {
|
||||
else
|
||||
{
|
||||
next_box = boxes[next_box] as usize;
|
||||
if next_box == i as usize
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if !found
|
||||
@ -66,6 +65,7 @@ fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
// print result
|
||||
if all_found
|
||||
{
|
||||
println!("All prisoners found their numbers!");
|
||||
|
Loading…
Reference in New Issue
Block a user