/*---------------------------------------------------------- * HTBLA-Leonding / Class: * --------------------------------------------------------- * Exercise Number: B1 * Title: Mine Sweeper * Author: *//* * ---------------------------------------------------------- * Description: * The declaration of an Abstract Data Type representing * a single cell of the Mine Sweeper board. * ---------------------------------------------------------- */ /* Note: The 'CellMarker' enumeration is declared in 'general.h' to enable mapping between enum and presentation in 'ms_ui_utils' */ /** Declares type for a single 'Mine Sweeper' cell */ /** * Provides another, yet unused instance, initialized Mine Sweeper cell * The provided cell is covered, carries no marker, no mine, and has 0 dangerous neighbors. * * Up to `MAX_BOARD_SIZE * MAX_BOARD_SIZE` cells can be produced by subsequent * calls of this function. * * @return The fresh cell instance or 0, if no more instance is available. */ msc_produce_cell(); /** * Resets the internal cell factory. Function `msc_produce_cell` is capable * to produce the full number of cell after this function is called. */ msc_reset_cell_factory(); /** * Determines whether or not the given cell is valid. * A cell is NOT valid, if it is 0 or has a neighbor mine count * greater than 8. * * @param cell The cell instance in focus. * @return True if the given cell is valid, false otherwise. */ msc_is_valid(); /** * Determines whether or not the given cell is currently covered. * * @param cell The cell instance in focus. * @return True if the given cell is covered, false otherwise. */ msc_is_covered(); /** * Uncovers the given cell. * If the cell carries a veritable marker (detected or suspected) * or is already uncovered, the request is ignored. Otherwise * function `msc_is_covered` returns `false` for this cell afterwards. * * Note: an uncovered cell cannot be covered again. * * @param cell The cell instance in focus. */ msc_uncover(); /** * Determines whether or not the given cell carries a mine. * * @param cell The cell instance in focus. * @return True if the cell carries a mine, false otherwise. */ msc_has_mine(); /** * Specifies that the given cell carries a mine. * Invocations for invalid cells are ignored. * * @param cell The cell instance in focus. */ msc_drop_mine(); /** * Provides the number of direct neighbor cells, which carries a mine. * * @param cell The cell instance in focus. * @return The number between 0 to 8 that encounters the neighbor cells * that carries a mine or 255 if the cell is not valid. */ msc_get_dangerous_neighbor_count(); /** * Increments (+1) the count of neighbor cells that carries a mine. * Invocations for invalid cells are ignored. * * @param cell The cell instance in focus. */ msc_inc_dangerous_neighbor_count(); /** * Provides the given marker of the given cell. * * @param cell The cell instance in focus. * @return The marker carried by the cell * or `NONE`, if the cell is not valid. */ msc_get_marker(); /** * Applies the given marker to the given cell. The marker is cleared * by applying a 'none' marker. * Invocations for invalid cells are ignored. * * @param cell The cell instance in focus. * @param marker The marker to apply. */ msc_set_marker();