Welcome to Battleship!
Rules:
Sink the computer's ships before the computer sinks yours! Both you and the computer will place your ships to start the game, then the game begins! Each team will take one shot each round at the other team's board and will be informed whether the shot was a hit or a miss. A winner is crowned when the first player sinks both ships of the opposing player.
How to play:
-
Start the game by navigating to the Battleship directory in your terminal, entering "ruby runner.rb", then clicking the return key.
-
After the game has been initiated, you will first be asked to click "P" to play, or "Q" to quit. Please enter the your response exactly as prompted with either letter.
-
If "P" is entered, you will be asked to place your ships, starting with the cruiser. The cruiser is three cells long. To input your ship, please enter the three cells in which you wish for the cruiser to be placed, with exactly one space in between each. Examples; "A1 A2 A3" or "A1 B1 C1." The cells must be placed in exact order for the game to continue. Once you have selected the cells, hit the return key. You will then be prompted to enter your submarine. Please follow the same steps as above, but be aware the submarine is only two cells in length.
-
Once your ships are placed, you will be asked to take your first shot. Select a coordinate within the map, ranging anywhere from "A1" to "D4." Again, the coordinate must be entered exactly as the coordinate stands or you will be asked to re-enter.
-
The game will tell you whether you shot was a hit or a miss and will show you the current playing boards.
-
The game will end once both ships have been sunk on either team.
Good luck!