Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- note
- description: "Captures the status of a minesweeper cell"
- author: "Nazareno Aguirre"
- date: "22/08/2012"
- revision: "Rev. 0"
- class
- MINESWEEPER_CELL
- create
- make
- feature -- Initialization
- make
- -- Make a cell closed, unmarked, with no mine.
- do
- end
- feature -- Access
- feature -- Status report
- is_mined : BOOLEAN
- -- Is cell mined?
- is_opened : BOOLEAN
- -- Is cell opened?
- is_closed : BOOLEAN
- -- Is cell closed?
- is_marked : BOOLEAN
- -- Is cell marked with a flag?
- feature -- Status setting
- open
- -- Opens cell
- do
- end
- mark
- -- Marks cell with a flag
- do
- end
- unmark
- -- Unmarks a marked cell
- require
- is_closed and is_marked
- do
- ensure
- is_marked = false
- end
- mine
- -- put a mine in this cell
- -- this method should only be used once
- -- TODO : discuss implementation
- do
- end
- end
Add Comment
Please, Sign In to add comment