From 21a8a4e48432ff986aa50653d85f1c0db2f123f9 Mon Sep 17 00:00:00 2001 From: dawidg81 Date: Thu, 29 Jan 2026 15:34:48 +0100 Subject: updated documentation --- docs/docs/code.md | 3 --- docs/docs/code/classes.md | 23 +++++++++++++++++++++++ docs/docs/code/intro.md | 7 +++++++ 3 files changed, 30 insertions(+), 3 deletions(-) delete mode 100644 docs/docs/code.md create mode 100644 docs/docs/code/classes.md create mode 100644 docs/docs/code/intro.md diff --git a/docs/docs/code.md b/docs/docs/code.md deleted file mode 100644 index e1ac884..0000000 --- a/docs/docs/code.md +++ /dev/null @@ -1,3 +0,0 @@ -# Code documentation - -This site documentates minesweeper code. \ No newline at end of file diff --git a/docs/docs/code/classes.md b/docs/docs/code/classes.md new file mode 100644 index 0000000..b837110 --- /dev/null +++ b/docs/docs/code/classes.md @@ -0,0 +1,23 @@ +# Classes + +The code is mostly being structured in classes. + +## `Game` + +`Game` class is operating on game logic, display and usage. + +### Global variables + +#### Public + +##### `editDiff()` + +A function of type `int`. Responsible for providing interface letting user edit custom game parameters (fourth difficulty option). Uses methods from `Utils` class. Detailed specification of this function is `int editDiff()`. + +##### `initDiff()` + +A function of type `void`. This function sets game parameters (`boardWidth`, `boardHeight`, `mines`) to specified value depending on gived difficulty value `diff` (type `int`). The function requires a `diff` parameter of type `int`. Full specification of declaration of this function is `void initDiff(int diff)`. + +First difficulty is *Easy* with `diff` value of 0, second difficulty is *Medium* with `diff` value of 1, third difficulty is *Hard* with `diff` value of 2, fourth difficulty is *Custom* with `diff` value of 3. On *Custom* difficulty given, `editDiff()` is being called. + +Plot width, which means how much cells wide is the plot, is declared as `boardWidth`. The same with `boardHeight`. Amount of mines randomly placed in cells is declared as `mines`. These three variables are a type of `int` and are being properly set by `initDiff()` function. For *Easy* difficulty, all three variables are set to value `9`, which means that the plot is 9 cells wide and high, with 9 bombs randomly spread across the plot. diff --git a/docs/docs/code/intro.md b/docs/docs/code/intro.md new file mode 100644 index 0000000..e942db3 --- /dev/null +++ b/docs/docs/code/intro.md @@ -0,0 +1,7 @@ +# Code documentation + +This site documentates minesweeper code. + +## Chapters + +- [Classes](classes.md) -- cgit v1.2.3