Skip to content

caizhangbin/BattleShip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

this program is a version of the game of Battleship against the computer. this simplified version of the game will be played on a single 8 by 8 grid. Before the actual game, each player secretly places 6 ships and 4 grenades on the grid. Ships and grenades are a single position on the grid. The position of these ships and grenades are of course hidden from the opponent. Once both player and computer have placed their ships and grenades, the actual game starts. Each player, in turn, “shoots a rocket” on the grid (i.e. calls a position).

  • If the rocket (the position called) falls on a position where there is nothing, then nothing happens, and the other player can shoot his/her rocket.
  • If the rocket falls on a coordinate where the opponent (or the player) has a grenade, then the player loses a turn, and next time, the opponent will play twice in a row.
  • If the rocket falls on a coordinate where the opponent (or the player...) has a ship, then that ship sinks.
  • If the rocket falls on a coordinate that has been called before, regardless of what was there before, nothing happens. (So, for example, a grenade can only explode once). The goal of the game is to sink all of your opponent’s ships before your opponent sinks yours. For the sake of simplicity, ships and grenades cannot overlap. So, you cannot have 2 grenades on the same position, have 2 ships on the same position, or have a grenade on a ship.

About

a battle ship game

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages