blob: 45fbf10b1fd3a1d240c657bf57db12e02a48b412 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
pub type Grid = Vec<Vec<(i8, bool)>>;
pub fn read_grid_from_stdin() -> Grid {
let mut grid = Vec::<Vec<(i8, bool)>>::new();
let mut line = String::new();
while std::io::stdin().read_line(&mut line).unwrap() > 0 {
let row = line[..line.len()-1].as_bytes().iter()
.map(|b| ((*b as i8) - ('0' as i8), false)).collect();
grid.push(row);
line.clear();
}
grid
}
|