Skip to content

Battleship Game is a two-player, turn-based strategy game implemented in Node.js. Players place ships on an 8x8 grid and take turns guessing the opponent’s ship locations until one fleet is completely sunk, demonstrating core object-oriented programming principles in a fun, interactive console-based format.

License

Notifications You must be signed in to change notification settings

fatima-ashfaq/BattleshipGame-JavaScript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

BattleshipGame-JavaScript

Battleship Game is a two-player, turn-based strategy game implemented in Node.js. Players place ships on an 8x8 grid and take turns guessing the opponent’s ship locations until one fleet is completely sunk, demonstrating core object-oriented programming principles in a fun, interactive console-based format.

How to Run

  1. Make sure Node.js is installed on your computer.

  2. Download the file BattleshipGame.js to your local machine.

  3. Open a terminal/command prompt and navigate to the directory containing the game file: cd path/to/your/file

  4. Run the game using Node.js: .load BattleshipGame.js

    image

Game Instructions

  1. Each player will be prompted to place their ships on the grid.
  2. Enter the starting coordinates for each ship (e.g., A1) and specify the orientation (horizontal/vertical) and direction (left/right/up/down).
  3. After both players place their ships, the game begins.
  4. Players take turns shooting at the opponent's grid by entering target coordinates.
  5. Hits are marked with 'X' and misses with 'O'.
  6. The game continues until all ships of one player are sunk.

Ship Sizes

  • Carrier: 5
  • Battleship: 4
  • Cruiser: 3
  • Submarine: 3
  • Destroyer: 2

About

Battleship Game is a two-player, turn-based strategy game implemented in Node.js. Players place ships on an 8x8 grid and take turns guessing the opponent’s ship locations until one fleet is completely sunk, demonstrating core object-oriented programming principles in a fun, interactive console-based format.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published