Giter Club home page Giter Club logo

minesweeper-game's Introduction

Minesweeper Game

The Minesweeper game is a Python terminal game, wich runs in the Code institue mock terminal on Heroku.

User wins by diggin in different possitions on the board evoiding mines.

Heroku link project. Heroku

GitHub link project. GitHub

Responsive

How to Play

The Minesweeper game is based on the classic video game creted by Curt Johnson for IBM's OS/2. You can read more on wikipedia

  • A board is randomly generated.

  • The player can see a board with positions 0 to 9 for rows and columns.

  • Mines are marked as *

  • The player will input a number for a row followed by a coma and a number for a column. Example 1,6.

  • Squares contain numbers, with each number being the number of mines adjacent to the uncovered square.

  • If a mine is found is Game Over, if not continue digging.

  • If a dig at location has no neighboring mine it will keep dig recursively to neighbors.

  • Player will win when there are no more places to dig and no mine its found.

Existing Features

  • Random board generation
  • Mines are randomly placed on the board

initial

  • Accepts user input
  • Maintain information in dug positions.
  • Shows squares containing numbers, with each number being the number of mines adjacent to the uncovered square.

input

  • Input validation and error checking
  • You cannot enter coordinates outside the size of the board.
  • You cannot enter the same guess twice

errorCeck

-Data maintained in class instances

Future Features

  • Allow player to select the board size.
  • Allow player to mark positions as not safe.
  • Allow player select the number of mines position on the board.

Data Model

I decided to use a Board class as my model. The game create an instance of a Board class.

The Board class stores the board size, the mines planted, the number of neighboring mines, showing the board, where to dig, showing the board.

The class also has methods to help play the game, such as create_new_board wich creates the board, allocate_values_to_board to places the mines on the board, obtain_num_neighboring_mines to show how close you are to mines from the position dug, dig to keep playing in case of successfull dig or Game over in case mine found and also if a dig at location has no neighboring mine it will keep dig recursively to neighbors, __str__ It will return a string that shows the board to the player.

Testing

I have manually tested this project by doing the following:

  • Tested in my local terminal and the Code institue Heroku terminal.

  • Passed the code through a PEP8 linter and confirmed there are no major issues.

  • Giving invalid inputs: Same input twice, out of bounds.

Bugs

  • Unsolved Bug

When the user inputs a string the game it will end. When the user inputs an empty value the game will end. When the user inputs a negative number the game will end. When the user inputs more than 2 values for row and col the game it will end.

  • Solved Bug

Fixed error regarding not adding the number of neighonroing mines, check the code and i go tboard[r][c] == '*':num_neighboring_mines += 1 fixed by adding self. like this self.board[r][c] == '*':num_neighboring_mines += 1

Validator Testing

  • PEP8
  • No major error found in PEP8online.com

image

Deployment

This project was deployed using Code Institute's mock terminal for Heroku.

Steps for deployment:

  • Frok or clone this repository
  • Create a bew Heroku app
  • Set the buildbacks to Python and NodeJS in that order
  • Click on Deploy

Credits

  • Code Institute for the deployment terminal
  • Wikipedia for the details of the Minesweeper game.
  • Minesweeper Game inspered on video

minesweeper-game's People

Contributors

juanmanuelnaya 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.