Coder Social home page Coder Social logo

jasonhsu93 / minesweeper2 Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 893 KB

This project implements a Minesweeper game using React for the frontend and Node.js for the backend. The game follows the classic Minesweeper rules and includes features like safe first click, flagging cells, and a timer to track the game duration.

HTML 36.29% JavaScript 26.02% CSS 5.38% TypeScript 32.31%

minesweeper2's Introduction

Minesweeper

This project implements a Minesweeper game using React for the frontend and Node.js for the backend. The game follows the classic Minesweeper rules and includes features like safe first click, flagging cells, and a timer to track the game duration.

Installation Prerequisites

Clone the repo
Node.js (v14 or higher)
npm (v6 or higher)

Backend Setup

  1. cd minesweeper2/minesweeper-backend
  2. Install the backend dependencies: npm install
  3. Start the backend server: node index.js

Frontend Setup

  1. cd minesweeper2/minesweeper
  2. Install the frontend dependencies: npm install
  3. Start the frontend: npm start

Flow

Open your browser and navigate to http://localhost:3000. Click "Restart Game" to restart a game. Left-click on squares to reveal them. Right-click on squares to flag them. The game ends when all non-mine squares are revealed or a mine is clicked.

Optional

To test API calls, open the index.html file in a browser and interact with the file. One may need to go to minesweeper2/minesweeper-backend/index.js to modify the Middleware so that API calls are accepted. like this:

// Middleware to handle CORS and allow credentials
app.use(cors({
origin: '*', // Allow any origin for testing APIs
//origin: 'http://localhost:3000', //comment this out when testing for API calls
credentials: true,
allowedHeaders: ['Content-Type', 'Authorization']
}));

Make sure to restart the backend server.

minesweeper2's People

Contributors

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