mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Michele Sessa
a1146d5755
|
1 year ago | |
---|---|---|
.. | ||
README.md | 1 year ago |
README.md
minesweeper
Instructions
Create a function that takes a minesweeper board as an array of strings and return the board solved.
Minesweeper is a very old game where some mines are placed in a board and you should calculate how many mines are touching every free field and write the count in the respective place.
We will only test your function with empty and valid boards.
Expected Function
pub fn solve_board(minefield: &[&str]) -> Vec<String> {
}
Usage
Here is a possible program to test your function,
fn main() {
println!("{:?}", solve_board(&[]));
println!("{:?}", solve_board(&[""]));
println!("{:?}", solve_board(&["***"]));
println!("{:#?}", solve_board(&[" ", " * ", " ",]));
println!("{:#?}", solve_board(&["* ", " ", " *",]));
}
And its output:
$ cargo run
[]
[""]
["***"]
[
"111",
"1*1",
"111",
]
[
"*1 ",
"121",
" 1*",
]
$