Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A React + NodeJS implementation of the 2-player guessing game: Battleship. Features online multiplayer.

License

NotificationsYou must be signed in to change notification settings

UsmanJafri/Battleship

Repository files navigation

A React + NodeJS implementation of the 2-player guessing game: Battleship. Features online multiplayer.

Requirements

  1. Node.js (Tested onv14.16.0)
  2. JavaScript-capable browser (Tested on Google Chrome)2. JavaScript-capable browser (Tested on Google Chromev88.0.4324.150)

Instructions (Client)

  1. To play the Battleship game, browse to/client.html of the host URL. (e.g:http://localhost:8000/client.html)

  2. Two grids will be presented:

    1. Ship Grid: This is where the player positions their ships for the opponent to guess and attack
    2. Guess Grid: This is where the player guesses and tries to attack the opponent's ships
  3. Use the drop-down list to select the type of ship to place

    Ship NameLengthColor
    Aircraft Carrier5Red
    Battleship4Black
    Cruiser3Grey
    Destroyer2Yellow
    Submarine1Green
  4. Left-click to place the ship horizontally or right-click to place the ship vertically

  5. If a ship needs repositioning, repeat steps 3 - 4

  6. Once all ships have been placed, press Start Game

  7. If an opponent is not available, please wait for an opponent

  8. Once an opponent is available, use the guess grid to attack enemy positions, a cross represents a successful hit whereas a nought represents a miss

  9. The first person to sink all ships wins

Instructions (Server)

  1. Open a Terminal window in the directory containingserver.js and run:

npm install

  1. Run the Battleship Server using the command:

npm start

  1. The server console window will display connection logs

Features

  • Server-side verification of ship placement and turns to prevent cheating
  • Realtime grid update and message notification of every turn's outcome
  • Multiple parallel game instances
  • Player notified if opponent leaves

About

A React + NodeJS implementation of the 2-player guessing game: Battleship. Features online multiplayer.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp