Skip to content

A command line Ruby battleship game program, mainly for learning

Notifications You must be signed in to change notification settings

atomicman57/battleship

 
 

Repository files navigation

How to play

ruby battleship.rb

Setup

Make sure Ruby is installed on your system. Run battleship.rb from the command line. The only other file needed to run the program is better_algorithm.rb. (Of course we'd love to see a web or desktop version of this.)

Run the program and follow the on-screen prompts.

Gameplay

There are two phases:

  • Setup game
  • Play game

To setup the game, for each ship, simply choose h or v for horizontal, then the coordinates (with lowercase letter followed by number, e.g., a1).

To play, simply type in coordinates of your attacks. To make the game more readable, there are many "Enter to continue..." prompts.

There may be some bugs. There may also be some puzzling text that appears on the console, left over from testing.

How to test

There are no unit tests set up yet. Developers are encouraged to develop some.

bundle exec rspec spec will run the current available test(s).

Developer notes

This battleship game was started by Larry Sanger as his first "big" project written in Ruby. Larry learned Perl back in 2002 but never used it professionally. He has helped to start many websites, but never as a programmer. He's decided that his project management skills would be enhanced by learning actual coding. So he started learning Ruby (in order to learn Rails) in June 2016.

The code as of Sept. 10, 2016 (day of first uploading to Github) is very amateurish. It desperately needs to be refactored in keeping with good programming practices. Experienced Ruby devs are strongly encouraged to contact Larry at yo.larrysanger@gmail.com with refactoring advice and tasklists.

About

A command line Ruby battleship game program, mainly for learning

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%