Guest User

Untitled

a guest
Sep 25th, 2018
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Eiffel 1.11 KB | None | 0 0
  1. note
  2.     description: "Captures the status of a minesweeper cell"
  3.     author: "Nazareno Aguirre"
  4.     date: "22/08/2012"
  5.     revision: "Rev. 0"
  6.  
  7. class
  8.     MINESWEEPER_CELL
  9.  
  10. create
  11.     make
  12.  
  13. feature -- Initialization
  14.  
  15.         make
  16.                 -- Make a cell closed, unmarked, with no mine.
  17.             do
  18.             end
  19.  
  20. feature -- Access
  21.  
  22. feature -- Status report
  23.  
  24.     is_mined : BOOLEAN
  25.             -- Is cell mined?
  26.  
  27.     is_opened : BOOLEAN
  28.             -- Is cell opened?
  29.  
  30.     is_closed : BOOLEAN
  31.             -- Is cell closed?
  32.  
  33.     is_marked : BOOLEAN
  34.             -- Is cell marked with a flag?
  35.  
  36. feature -- Status setting
  37.  
  38.         open
  39.                 -- Opens cell
  40.             do
  41.             end
  42.  
  43.         mark
  44.                 -- Marks cell with a flag
  45.             do
  46.             end
  47.  
  48.         unmark
  49.                 -- Unmarks a marked cell
  50.             require
  51.                 is_closed and is_marked
  52.             do
  53.            
  54.             ensure
  55.                 is_marked = false
  56.             end
  57.  
  58.         mine
  59.             -- put a mine in this cell
  60.             -- this method should only be used once
  61.             -- TODO : discuss implementation
  62.             do
  63.             end
  64.  
  65.  
  66. end
Add Comment
Please, Sign In to add comment