Added my name & continued at ms_board.h

This commit is contained in:
MarcUs7i 2025-01-28 16:39:02 +01:00
parent f5175c483d
commit 16732fd116
10 changed files with 52 additions and 26 deletions

View file

@ -3,7 +3,7 @@
* --------------------------------------------------------- * ---------------------------------------------------------
* Exercise Number: n/a * Exercise Number: n/a
* Title: general.h * Title: general.h
* Author: P. Bauer, S. Schraml, */<your name>/* * Author: P. Bauer, S. Schraml, Marc Tismonar
* ---------------------------------------------------------- * ----------------------------------------------------------
* Description: * Description:
* General usable definitions and types. * General usable definitions and types.
@ -29,23 +29,30 @@ typedef unsigned short ColAddr;
typedef char RowAddr; typedef char RowAddr;
/** CellMarker: The enumeration of cell markers. */ /** CellMarker: The enumeration of cell markers. */
typedef enum {
NONE, /* cell is not marked */ NONE, /* cell is not marked */
MINE_DETECTED, /* cell carries a mine */ MINE_DETECTED, /* cell carries a mine */
MINE_SUSPECTED /* cell is suspected to carry a mine */ MINE_SUSPECTED /* cell is suspected to carry a mine */
} CellMarker;
/** GameMode: The enumeration of defined game modes (sizes) */ /** GameMode: The enumeration of defined game modes (sizes) */
typedef enum {
BEGINNER, /* a 'small' game, e.g. 8x8 cells having a low number of mines (e.g. 10) */ BEGINNER, /* a 'small' game, e.g. 8x8 cells having a low number of mines (e.g. 10) */
ADVANCED, /* a 'medium' game, e.g. 16x16 cells having a medium number of mines (e.g. 40) */ ADVANCED, /* a 'medium' game, e.g. 16x16 cells having a medium number of mines (e.g. 40) */
EXPERT, /* a 'large' game, e.g. 26x18 cells having a high number of mines (e.g. 99) */ EXPERT, /* a 'large' game, e.g. 26x18 cells having a high number of mines (e.g. 99) */
CUSTOM, /* a customized game, number of columns, rows, and mines are defined by the user */ CUSTOM, /* a customized game, number of columns, rows, and mines are defined by the user */
} GameMode;
/** GameState: The enumeration of game states. */ /** GameState: The enumeration of game states. */
typedef enum {
INVALID, /* default state */ INVALID, /* default state */
IN_PROGRESS, /* the game is currently played */ IN_PROGRESS, /* the game is currently played */
SOLVED, /* the game was successfully completed */ SOLVED, /* the game was successfully completed */
FAILED /* the game was not successfully completed */ FAILED /* the game was not successfully completed */
} GameState;
/** Action: The enumeration of possible user input actions. */ /** Action: The enumeration of possible user input actions. */
typedef enum {
UNKNOWN, /* default state, input was not recognized */ UNKNOWN, /* default state, input was not recognized */
CELL_SELECT, /* the user entered a (possibly invalid) cell address. */ CELL_SELECT, /* the user entered a (possibly invalid) cell address. */
MARK_MINE, /* the action to mark the selected cell having a mine */ MARK_MINE, /* the action to mark the selected cell having a mine */
@ -53,6 +60,7 @@ typedef char RowAddr;
CLEAR_MARKER, /* the action for removing a marker on the selected cell */ CLEAR_MARKER, /* the action for removing a marker on the selected cell */
UNCOVER, /* the action to uncover a (possibly) selected cell */ UNCOVER, /* the action to uncover a (possibly) selected cell */
QUIT_GAME, /* the action to terminate the game */ QUIT_GAME, /* the action to terminate the game */
} Action;
/** Convenience macro do get maximum of two numbers */ /** Convenience macro do get maximum of two numbers */
#define MAX(x, y) ((x) > (y) ? (x) : (y)) #define MAX(x, y) ((x) > (y) ? (x) : (y))

View file

@ -1,9 +1,9 @@
/*---------------------------------------------------------- /*----------------------------------------------------------
* HTBLA-Leonding / Class: <your class> * HTBLA-Leonding / Class: 2IHIF
* --------------------------------------------------------- * ---------------------------------------------------------
* Exercise Number: B1 * Exercise Number: B1
* Title: Mine Sweeper Board implementation * Title: Mine Sweeper Board implementation
* Author: */<your name>/* * Author: Marc Tismonar
* ---------------------------------------------------------- * ----------------------------------------------------------
* Description: * Description:
* Implementation of ms_board.h. * Implementation of ms_board.h.

View file

@ -1,9 +1,9 @@
/*---------------------------------------------------------- /*----------------------------------------------------------
* HTBLA-Leonding / Class: <your class> * HTBLA-Leonding / Class: 2IHIF
* --------------------------------------------------------- * ---------------------------------------------------------
* Exercise Number: B1 * Exercise Number: B1
* Title: Mine Sweeper * Title: Mine Sweeper
* Author: */<your name>/* * Author: Marc Tismonar
* ---------------------------------------------------------- * ----------------------------------------------------------
* Description: * Description:
* The declaration of an Abstract Data Type representing * The declaration of an Abstract Data Type representing
@ -11,7 +11,17 @@
* ---------------------------------------------------------- * ----------------------------------------------------------
*/ */
#ifndef ___MS_BOARD_H
#define ___MS_BOARD_H
#include <stdbool.h>
#include "config.h"
#include "general.h"
#include "ms_cell.h"
/** MsBoard: Declares type for the 'Mine Sweeper' board */ /** MsBoard: Declares type for the 'Mine Sweeper' board */
typedef struct MsBoardData* MsBoard;
/** /**
* Provides the instance of the 'Mine Sweeper' board. * Provides the instance of the 'Mine Sweeper' board.
@ -20,6 +30,7 @@
* *
* @return The board instance. * @return The board instance.
*/ */
MsBoard msb_get_board();
/** /**
* Initializes the only Mine Sweeper board: * Initializes the only Mine Sweeper board:
@ -31,7 +42,7 @@
* @param column_count The number of cell columns of the board. * @param column_count The number of cell columns of the board.
* @param row_count The number of cell row of the board. * @param row_count The number of cell row of the board.
*/ */
<type> msb_init_board(<params>); void msb_init_board(MsBoard board, Count column_count, Count row_count);
/** /**
* Determines whether or not the given board is valid. * Determines whether or not the given board is valid.
@ -42,7 +53,7 @@
* @param board The board instance in focus. * @param board The board instance in focus.
* @return True if the given board is valid, false otherwise. * @return True if the given board is valid, false otherwise.
*/ */
<type> msb_is_valid(<params>); bool msb_is_valid(MsBoard board);
/** /**
* Provides the cell at the given coordinates. * Provides the cell at the given coordinates.
@ -52,7 +63,7 @@
* @param row_idx The index of the row of the addressed cell. * @param row_idx The index of the row of the addressed cell.
* @return The addressed cell or 0, if the coordinates are not in range. * @return The addressed cell or 0, if the coordinates are not in range.
*/ */
<type> msb_get_cell(<params>); MsCell msb_get_cell(MsBoard board, CellIdx col_idx, CellIdx row_idx);
/** /**
* Provides the number of columns used by the current game (of the 'active' area). * Provides the number of columns used by the current game (of the 'active' area).
@ -61,7 +72,7 @@
* @return The number of columns used for the current board configuration or 0, * @return The number of columns used for the current board configuration or 0,
* if the board is not configured or invalid. * if the board is not configured or invalid.
*/ */
<type> msb_get_column_count(<params>); Count msb_get_column_count(MsBoard board);
/** /**
* Provides the number of rows used by the current game (of the 'active' area). * Provides the number of rows used by the current game (of the 'active' area).
@ -70,4 +81,6 @@
* @return The number of columns used for the current board configuration or 0, * @return The number of columns used for the current board configuration or 0,
* if the board is not configured or invalid. * if the board is not configured or invalid.
*/ */
<type> msb_get_row_count(<params>); Count msb_get_row_count(MsBoard board);
#endif

View file

@ -1,9 +1,9 @@
/*---------------------------------------------------------- /*----------------------------------------------------------
* HTBLA-Leonding / Class: <your class> * HTBLA-Leonding / Class: 2IHIF
* --------------------------------------------------------- * ---------------------------------------------------------
* Exercise Number: B1 * Exercise Number: B1
* Title: Mine Sweeper Cell implementation * Title: Mine Sweeper Cell implementation
* Author: */<your name>/* * Author: Marc Tismonar
* ---------------------------------------------------------- * ----------------------------------------------------------
* Description: * Description:
* Implementation of ms_cell.h. * Implementation of ms_cell.h.

View file

@ -1,9 +1,9 @@
/*---------------------------------------------------------- /*----------------------------------------------------------
* HTBLA-Leonding / Class: <your class> * HTBLA-Leonding / Class: 2IHIF
* --------------------------------------------------------- * ---------------------------------------------------------
* Exercise Number: B1 * Exercise Number: B1
* Title: Mine Sweeper * Title: Mine Sweeper
* Author: */<your name>/* * Author: Marc Tismonar
* ---------------------------------------------------------- * ----------------------------------------------------------
* Description: * Description:
* The declaration of an Abstract Data Type representing * The declaration of an Abstract Data Type representing
@ -11,6 +11,9 @@
* ---------------------------------------------------------- * ----------------------------------------------------------
*/ */
#ifndef ___MS_CELL_H
#define ___MS_CELL_H
/* Note: The 'CellMarker' enumeration is declared in 'general.h' /* Note: The 'CellMarker' enumeration is declared in 'general.h'
to enable mapping between enum and presentation in 'ms_ui_utils' */ to enable mapping between enum and presentation in 'ms_ui_utils' */
@ -114,3 +117,5 @@
* @param marker The marker to apply. * @param marker The marker to apply.
*/ */
<type> msc_set_marker(<params>); <type> msc_set_marker(<params>);
#endif

View file

@ -1,9 +1,9 @@
/*---------------------------------------------------------- /*----------------------------------------------------------
* HTBLA-Leonding / Class: <your class> * HTBLA-Leonding / Class: 2IHIF
* --------------------------------------------------------- * ---------------------------------------------------------
* Exercise Number: B1 * Exercise Number: B1
* Title: Mine Sweeper GAme implementation * Title: Mine Sweeper Game implementation
* Author: */<your name>/* * Author: Marc Tismonar
* ---------------------------------------------------------- * ----------------------------------------------------------
* Description: * Description:
* Implementation of ms_game.h. * Implementation of ms_game.h.

View file

@ -1,9 +1,9 @@
/*---------------------------------------------------------- /*----------------------------------------------------------
* HTBLA-Leonding / Class: <your class> * HTBLA-Leonding / Class: 2IHIF
* --------------------------------------------------------- * ---------------------------------------------------------
* Exercise Number: B1 * Exercise Number: B1
* Title: Mine Sweeper * Title: Mine Sweeper
* Author: */<your name>/* * Author: Marc Tismonar
* ---------------------------------------------------------- * ----------------------------------------------------------
* Description: * Description:
* The declaration of an Abstract Data Type representing * The declaration of an Abstract Data Type representing

View file

@ -1,9 +1,9 @@
/*---------------------------------------------------------- /*----------------------------------------------------------
* HTBLA-Leonding / Klasse: n/a * HTBLA-Leonding / Klasse: 2IHIF
* --------------------------------------------------------- * ---------------------------------------------------------
* Exercise Number: B1 * Exercise Number: B1
* Title: Mine Sweeper * Title: Mine Sweeper
* Author: */<your name>/* * Author: Marc Tismonar
* ---------------------------------------------------------- * ----------------------------------------------------------
* Description: * Description:
* The Mine Sweeper Application. * The Mine Sweeper Application.

View file

@ -1,9 +1,9 @@
/*---------------------------------------------------------- /*----------------------------------------------------------
* HTBLA-Leonding / Class: <your class> * HTBLA-Leonding / Class: 2IHIF
* --------------------------------------------------------- * ---------------------------------------------------------
* Exercise Number: B1 * Exercise Number: B1
* Title: Mine Sweeper User Interface Utilities * Title: Mine Sweeper User Interface Utilities
* Author: */<your name>/* * Author: Marc Tismonar
* ---------------------------------------------------------- * ----------------------------------------------------------
* Description: * Description:
* Implementation of ms_ui_utils.h. * Implementation of ms_ui_utils.h.

View file

@ -1,9 +1,9 @@
/*---------------------------------------------------------- </*----------------------------------------------------------
* HTBLA-Leonding / Class: <your class> * HTBLA-Leonding / Class: 2IHIF
* --------------------------------------------------------- * ---------------------------------------------------------
* Exercise Number: B1 * Exercise Number: B1
* Title: Mine Sweeper User Interface Utilities * Title: Mine Sweeper User Interface Utilities
* Author: */<your name>/* * Author: Marc Tismonar
* ---------------------------------------------------------- * ----------------------------------------------------------
* Description: * Description:
* The declaration of a library providing utility functions * The declaration of a library providing utility functions