Skip to content

The BattleShips program is a PvP game, in which every player has a map 10x10 filled with 10 ships and they try to hit each other's ship in order to win the game.

Notifications You must be signed in to change notification settings

AlexandruSte/BattleShips

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

BattleShips

At the beginning of the game, the first player needs to put all the coordinates of his ships.

Each player is given one ship of size 4, 2 ships of size 3, 3 ships of size 2 and 4 ships of size 1. For the ships of size bigger than 1, he has to write the coordinates of the beginning and the end of the boat.

If the introduced values are not correct (if they are bigger or smaller than the actual size of the ship or if they are out of the matrix) the program will give you more tries to write them correctly.

After the first player finishes placing his ships, the console clears itself, allowing the second player to place his ships, not seeing where the first one put his.

After the second player places his ships, the game begins!

Now, each player takes turns and try to guess each other's ships. The ships are memorized in a matrix. The players write down a pair of (x,y) and if they hit the other player's ship, on the map will be displayed a red "X", and if not it will be displayed a red circle. If they bomb a place they have already bombed, they receive another guess.

About

The BattleShips program is a PvP game, in which every player has a map 10x10 filled with 10 ships and they try to hit each other's ship in order to win the game.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages