Last active
June 4, 2018 01:39
-
-
Save kunigami/bcdb2508a183a3f5743b1294cfd380ca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn get_class(visited_bits: u32, guess: &[i32; N]) -> i32 { | |
let mut class_id = 0; | |
let mut multiplier: i32 = 1; | |
let d = (D + 1) as i32; | |
for pos in 0..guess.len() { | |
let digit = guess[pos]; | |
if visited_bits & (1 << digit) != 0 { | |
class_id += multiplier * (digit + 1); | |
} | |
multiplier *= d; | |
} | |
return class_id; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment