Created
August 8, 2019 09:49
-
-
Save fatihgokce/c231fdcf7353ce20060de126cbac5998 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 main() { | |
let rows=3; | |
let cols=4; | |
let mut state = [[ 0u8; 4]; 2]; | |
//let mut state = [[0u8; 4]; 5]; | |
state[0][1] = 42; | |
//println!("{:?}",state); | |
for (r,v) in state.iter().enumerate(){ | |
println!("{:?}",v); | |
} | |
let mut v = vec![vec![0; cols]; rows]; | |
v[0][0] = 1; | |
//println!("{:?}",v); | |
let width=2; | |
let height=2; | |
let cells:Vec<i8> = (0..width * height) | |
.map(|i| { | |
if i % 2 == 0 || i % 7 == 0 { | |
1 | |
} else { | |
0 | |
} | |
}) | |
.collect(); | |
//println!("{:?}",cells); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment