Skip to content

gabrielcnunez/battleship

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Battleship

Project Overview & Learning Goals

Battleship is a classic board game where players place one or more ships on a grid board, and then take turns trying to “sink” the other player’s ships by guessing their coordinates. The game ends when one player’s ships are all hit and “sunk”.

This project uses Ruby to build a command line implementation of the classic game Battleship, in order to demonstrate Test-Driven Development (TDD), algorithmic thinking, and Object Oriented Programming.

Built With

  • Ruby 2.7.2

Setup

  1. Clone the repository
  2. cd into the root directory
  3. Run the game ruby battleship_runner.rb
  4. You may run the RSpec test suite locally with bundle exec rspec

Features and Screenshots

  • Game board is presented in a grid, with the following:
  • . represents an empty space
  • S represents a ship on your board
  • H represents a hit
  • M represents a shot that missed
  • X represents a sunken ship

Screenshot 2023-07-15 at 3 12 35 PM

  • Option to customize board size from 4 to 10 rows/columns

Screenshot 2023-07-15 at 2 50 18 PM

  • Ability to detect when invalid coordinates are entered for ship placement or shot location Screenshot 2023-07-15 at 2 57 54 PM -Screenshot 2023-07-15 at 3 00 38 PM

  • After landing a hit, computer will make an educated guess for its next shot(s) until the ship is sunk

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages