Skip to content
Alphar edited this page Mar 14, 2024 · 16 revisions

Minesweeper Clone

A clone of the game Minesweeper resembling Google's version written in C for Windows. This project was created for a university assignment.

Main Idea

Our task was to get something together in two weeks that looks like and works like Minesweeper, with the addition of "rewind bombs". We made a rather eccentric decision to stick to CLI-based programs, but also try to make it feel like it has a GUI as much as possible. This game was inspired by the classic Minesweeper game available on Google, hence the looks of the game are quite similar to Google's version. From our past experiences with console games, there has been a huge improvement in the overall development process, despite that the source code is still a monolithic file. We take user input more gracefully, render the game state more appealingly, and implement more complex features.

Launch

The game starts with a little window greeting the player. The text slowly fills in and later it asks for a key press. Pressing Enter takes the player to the main menu. A short animation is performed before the main menu is listed. A big flashing sign at the top of the screen displays the title of the game with a short animation using a "sliding window" effect and a loading bar below. Note that we make extensive use of box-drawing characters to draw grids and borders, ANSI escape codes to manipulate foreground colors, background colors, and text styles, and Unicode emojis to represent various objects.


Launch

Menus & Prompts & Input Validation

All menus generally list all the options and actions you can perform with their brief descriptions. One important nuance here is that the player needs to enter options as plain texts, while some might expect it to listen for key presses. For consistency reasons, we have grouped texts into four categories in terms of their purpose:

  • # - Preceeds a comment or a block of info.
  • > - Preceeds a prompt and then user input.
  • ~ - Preceeds a warning message.
  • ! - Preceeds an error message.

Different texts will also be colored differently:

Type Color
Comments #82AAFF #82AAFF
Prompt & Input #89DDFF #89DDFF
Warning #4EC9B0 #4EC9B0
Error #FF6666 #FF6666
Number #EB7669 #EB7669
Option #ffCB6B #ffCB6B

The program will try to validate every possible user input and print an error message in case of a failure; users can re-enter their input after an error. Inputs are parsed case-insensitively, i.e. it does not matter whether a or A is entered. Prompts that require multiple arguments use white-space characters as delimiters (except for newline characters); additionally, all extra characters are trimmed and ignored. Below you can see a list of all options in the main menu (#), a prompt for the user (>), and a series of error messages for different reasons (!):


Menu

Clone this wiki locally