GitXplorerGitXplorer
s

minesweeper

public
9 stars
3 forks
0 issues

Commits

List of commits on branch master.
Unverified
427713cb84d3654ba2ff65ad634b2a862a3821ce

Update Makefile for running tests

kkabirbaidhya committed 5 years ago
Unverified
9bca899132fffeb4db0375db632002b857d8f4f0

Add test runner main function

kkabirbaidhya committed 5 years ago
Unverified
9936f1674fd21fa8678ee73d838f2cfa5494468b

Add tests for utils/number

kkabirbaidhya committed 5 years ago
Verified
54cade6360cb4e0444468c3ec90bf8b3fd2fe245

Create LICENSE

ssqugeim committed 5 years ago
Unverified
0dc577dbf5a54fdc4e62b47a0885200ae9a3d7e3

Update clean command

kkabirbaidhya committed 5 years ago
Unverified
a7d56fe7376c78c365db2377498586cf81250522

Clean the build binary as well

kkabirbaidhya committed 5 years ago

README

The README file for this repository.

minesweeper Build Status

A simple implementation of the classic Minesweeper in your terminal.

┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐
│ │ │ │1│1│3│#│2│ │ │ │ │1│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│
├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
│ │ │ │1│#│3│#│2│ │ │ │ │1│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│
├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
│ │ │ │1│1│2│2│2│1│ │ │ │1│3│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│
├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
│ │ │ │ │ │ │1│#│1│ │ │ │ │2│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│
├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
│ │ │1│2│2│1│1│1│1│ │ │ │ │1│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│
├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
│1│1│1│#│#│1│ │ │ │ │ │ │ │1│1│1│1│2│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│
├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
│▒│▒│▒│▒│▒│1│ │ │ │ │1│1│1│ │ │ │ │2│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│
├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
│▒│▒│▒│▒│▒│1│ │ │ │ │1│#│1│ │ │ │ │3│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│
├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
│▒│▒│▒│▒│▒│3│1│2│1│1│1│1│1│ │1│1│2│3│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│
├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│1│ │1│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│
├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│3│1│2│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│
├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│
├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│
├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│
├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│
├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│▒│
└─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘

Motivation

Just wanted a simple project to practice C.

How to Play

  • to move the cursor around.
  • SPACE to flag a cell. Flagged cells are represented with a #.
  • ENTER to reveal a cell. Bomb cells are represented with a .
  • q to exit at any time.

Architecture

You should find the code self-explanatory.

window.c manages the view layer of the game. It decides how the game is printed and how user input is taken. We use ncurses to print the game and take user input.

libminesweeper manages the game state and game logic.

Build

Use make to build the project.

$ make build

You may sometimes need to clean previous build artifacts:

$ make clean

For a debug-ready build:

$ make debug

I need help improving the Makefile. Any contributions welcome.

I am developing the project on MacOS with the default build chain installed by XCode. That means even though I say gcc in the Makefile, I am actually building with Clang. They aim to be source compatible with the original gcc.

My current "gcc" version = 4.2.1

$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin