Advertisement
RoshHoul

minesweeper

Sep 27th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1.  
  2.  
  3. Nasko loves to play Minesweeper on his PC. In Minesweeper the playfield is a 3x3 grid and in some of the squares there is a bomb.
  4. The goal of the player is to write a number in every cell that doesn't have a bomb. The number must show how many bombs are in the
  5. neighbour cells (cells that have common edge or a side). Write a minesweeper program, which takes the bomb positions as input and prints the grid with numbers filled in.
  6.  
  7. Input: In the first three lines of the standard input there are 3 real numbers and each one of them has value of either 0 or 9 (9 - bomb/ 0 - no bomb). The numbers are separated with a single whitespace.
  8. 9 0 0
  9. 0 0 9
  10. 0 0 0
  11.  
  12. Output: In the standart output, the program should print 3 lines with 3 real numbers in them. At the position of the "0"-s from the input, there shoult be a number indicating the bombs around it. Numbers are separated by a single white space:
  13.  
  14. Input: Output:
  15. 9 0 0 9 2 1
  16. 0 0 9 1 2 9
  17. 0 0 0 0 1 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement