min2phase

Function random_cube

Source
pub fn random_cube() -> String
Examples found in repository?
examples/main.rs (line 5)
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
30
31
32
33
34
35
36
37
38
39
40
fn main() {
	println!("Generate a random cube:"); 
	let cube: String = random_cube();
	println!("Generated: {}", cube);

	println!("Solve it in 21 moves..."); 
	let solution: String = solve(&cube, 21);
	println!("Result: {}", solution); 

	println!("Generate 30 random moves:"); 
	let moves: String = random_moves(30);
	println!("Generated: {}", moves);

	println!("Get scrambled cube:"); 
	let cube: Option<String> = from_moves(&moves);
	if let Some(cube) = cube {
		println!("Generated: {}", cube);
		println!("Solve it in 21 moves..."); 
		let solution = solve(&cube, 21);
		println!("Result: {}", solution); 
	} else {
		println!("Parse scramble error: {}", moves);
	}
/*
	let n_moves = 100;
	for _ in 0..100 {
		let scramble: String = random_moves(n_moves);
		if let Some(cube) = from_moves(&scramble) {
			println!("cubie={}", cube);
			println!("scramble={}", scramble);
			println!("solution={}", solve(&cube, 20));
		} else {
			println!("scramble={}", scramble);
			println!("move parse error!!");
		}
	}
*/
}