Giter Club home page Giter Club logo

minefield's Introduction

Minefield

This project can be used to keep track of a simplistic Minesweeper-like game that has a 10x10 field where mines can be placed. Initially, the mines are hidden and the user makes guesses to try to find all the empty spaces without choosing any of the hidden mines.

FieldType

FieldType is an enumerated type to represent the four possible states of the minefield:

MINE_HIDDEN a mine that has not been shown to the user

MINE_SHOWN a mine that has been shown to the user

EMPTY_HIDDEN an empty space that has not yet been guessed by the user

EMPTY_SHOWN an empty space that has been guessed by the user

Member Functions

Field() Constructor creates a 10x10 grid with no mines

void placeMine(int x, int y) Places a mine at the x,y coordinate in the field

FieldType get(int x, int y) Retrieves the state of the field at location (x,y)

bool isSafe(int x, int y) NOT YET IMPLEMENTED Returns whether or not _map at (x,y) has a mine and throws an exception if the location is illegal

void revealAdjacent(int x, int y) NOT YET IMPLEMENTED Changes the location from EMPTY_HIDDEN to EMPTY_SHOWN for the location and any valid locations adjacent (immediately above, below, left, or right as printed) to the provided (x,y) location

Quick Guide

A Makefile is provided that includes:

  • make clean removes all compilation and build files besides the source code

  • make builds the Field class and its test class

  • make test runs the FieldTest with a test runner

minefield's People

Contributors

kbuffardi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.