Initial commit

This commit is contained in:
github-classroom[bot] 2025-01-28 00:13:55 +00:00 committed by GitHub
parent 392362b8ee
commit 8c7ea4970a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
74 changed files with 8220 additions and 30 deletions

141
html/index.html Normal file
View file

@ -0,0 +1,141 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.18"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Mine Sweeper: Main Page</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen_extra.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Mine Sweeper
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.18 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="PageDoc"><div class="header">
<div class="headertitle">
<div class="title">Mine Sweeper Documentation</div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><h1><a class="anchor" id="intro"></a>
Introduction</h1>
<p>The console version of the popular 'Mine Sweeper' game.</p>
<p>The board consists of initially covered cells. Some of these cells carries mines.</p>
<p>Cells can be marked as having a mine (mine detected) or as being suspected of carrying a mine (mine suspected).</p>
<p>Cells can be uncovered to reveal their content. Cells may show a number after they are uncovered. This number tells how many of their eight direct neighbor cells carries a mine and are therefore 'dangerous neighbors'. If a cell without dangerous neighbors is uncovered, all neighbor cells of that cell are uncovered as well. If such a neighbor cell again has no dangerous neighbors, all neighbor cells of this cell are uncovered also, and so on.</p>
<p>The objective of the game is find all cells carrying a mine without uncovering those. The game is won, if each cell carrying a mine is marked as such (mine detected) AND all other cells are uncovered. If a cell that carries a mine is uncovered, the game is last as the mine detonates.</p>
<p>Cells are addressed by their column and row coordinate. Before any action can be taken on a cell, it need to be selected first. Afterwards actions such as setting or clearing markers as well as uncovering the cell can be performed. Alternatively a different cell can be selected. This approach shall avoid performing an action on a 'wrong' cell.</p>
<h1><a class="anchor" id="objective"></a>
Assignment Objective</h1>
<p>In this assignment the required Abstract Data Types and the game logic as well as user interface interaction shall be implemented. A visualizer for the complete game is provided and shall be used. The visualizer is also capable of capturing user inputs and provides the captured result.</p>
<p>The 'main loop' of the application shall be implemented in <code>ms_main_driver.c</code>, function <code>ui_branch</code>.</p>
<p>That main loop shall: #Start a game #visualize the initial game using <code>ms_visualizer</code> #evaluate the user input provided after <code>ms_visualize()</code> returns #perform the desired action, e.g. selecting a cell, set a marker, or quit the game #continue with step 2 until the captured action is 'quit' or the game is over (solved or failed)</p>
<p>The minimal main loop described above may be extended (surrounded) by an outer loop, which allows to restart a game in a different mode.</p>
<p>Note that <code>ms_visualizer</code> supported a 'cheat' mode, which shows the content of covered cells. This may be helpful during development.</p>
<p><b>Configuration</b></p>
<p>Because we operate on static memory, the maximum size of the board in each dimension can be configured in <code>config.h</code>.</p>
<p><b>Setup and Execution</b></p>
<p>Initially the board has the set number of cells, all cells are covered. No cell carries a mine at this point in time. After the user uncovers the first cell, the mines are distributes and the number of dangerous neighbors is calculated. The first uncovered cell shall be empty (and therefore uncover neighbor cells, as described above) for sure, to avoid ambiguous configuration on the first action.</p>
<p><b>Visualization</b></p>
<p>As described above, the visualization library realized by <code>ms_visualizer</code> is capable to render the complete game, including status bar and user prompts as well as capturing user input. User interface related texts and symbols can be more or less freely defined in <code>ms_ui_utils.c</code>. The visualizer does not make assumptions on marker presentation or input keys.</p>
<h1><a class="anchor" id="assignment"></a>
Assignment</h1>
<p>This is a rather complex assignment, therefore it is vital, to develop the code in a focused and clean way, step by step. Many unit tests are provided to ease development. Some unit tests provide also helpful debugging traces. If too many failed unit tests appear - especially at the beginning of development- they can be commented in file <code>ms_test_driver.c</code> for files that are currently not in focus. However, they need to be reactivated as development proceeds.</p>
<p>Hint: Read and obey the comment within the code.</p>
<ol type="1">
<li>Complete<ul>
<li>include guards</li>
<li>forward declarations,</li>
<li>types,</li>
<li>and function for ADTs in <code>ms_general.h</code>, <code>ms_cell.h</code>, <code>ms_board.c</code>, <code>ms_game.h</code>, and <code>ms_ui_utils.h</code>.</li>
</ul>
<ul>
<li>Types in template files may be marked as <code>&lt;type&gt;</code> within header and source files or may be omitted completely. Replace <code>&lt;type&gt;</code> with the correct type and complete missing types. Some types, those which are shared among multiple sources, are located in <code>general.h</code>.</li>
<li>Parameter lists of function in a template files may be missing or incomplete.</li>
</ul>
</li>
<li>Make the program and tests compile: Implement all functions in all relevant files declared in the headers EMTPY (return nothing, 0, false, ... as required).<ul>
<li>All unit tests shall run but FAIL after this step</li>
<li><b>&ndash;COMMIT&ndash;</b></li>
</ul>
</li>
<li>Implement the empty functions one by one to make the unit tests pass one by one.<ul>
<li>Proposed order: ms_ui_utils, ms_cell, ms_board, ms_game.</li>
<li>The purpose of a function is specified as API documentation within the header files.</li>
<li>Obey comments in source files. Run the unit tests frequently and fix failures.</li>
<li><b>&ndash;COMMIT&ndash; after each implemented function.</b></li>
</ul>
</li>
<li>Implement the main loop and other missing parts in <code>main_driver.c</code> functions.<ul>
<li><b>&ndash;COMMIT&ndash;</b></li>
</ul>
</li>
<li>Run the game and enjoy</li>
</ol>
<h1><a class="anchor" id="notes"></a>
Notes</h1>
<ol type="1">
<li>make cleantest: This new make target for clearing the console, building, and running unit test is available.</li>
<li>The unit test for solving the game <code>test_msg_get_state__success</code> fails in rare cases even if the implementation is corret.</li>
<li>Visualization is implemented for Linux shell, it will not work on Windows.</li>
<li>Sometimes changes are not properly detected by incremental builds. If something very strange happens during compilation, try to run <code>make clean</code> followed by <code>make</code> to start a clean build. This approach is also recommended after everthing is done, because some compiler warning appears only in clean builds. </li>
</ol>
</div></div><!-- PageDoc -->
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Sun Dec 27 2020 21:16:06 for Mine Sweeper by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.18
</small></address>
</body>
</html>