Code Monkey home page Code Monkey logo

minesweeper's Introduction

Coding Minesweeper walkthrough: Play here

  • Create the canvas and the 2D grid.
  • Every grid[i][j] = new Cell(location, width).
  • Create the bee's (mine's) and draw them on the canvas.
  • User click and Cell reveal:
    • Iterate through every cell and check if it contains (mouseX, mouseY).
    • If yes then reveal = true (show what the cell contains).
  • Cell count:
    • Default count = 0.
    • Every bee will add 1 to its neighbor.
    • That way we only iterate on the bee neighbors and not every cell in the grid.
  • Flood fill: Reveal all empty (value = 0) cells using recursive floodFill algorithm.
  • Flag: Put a flag with a right click.
  • Game Over: Reveal all bee's or Victory. Display the message at the bottom.

minesweeper's People

Contributors

pratham87 avatar

Watchers

James Cloos 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.