Skip to content

daeus/BattleshipGame

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BattleshipGame Exercise

The game is a demo exercise written in simple PHP web application without using any framework. It allows a single human player to play a one-sided game of battleships against the computer.

Game Explanation

The program will create a 10x10 grid, and place a number of ships on the grid at

random with the following sizes:

1 x Battleship (5 squares)
2 x Destroyers (4 squares)

Ships can touch but they must not overlap.
The application will accept input from the user in the format “A5” to signify a square to target, and feedback to the user whether the shot was success, miss, and additionally report on the sinking of any vessels.

no shot = '.'
miss = '-'
hit = 'X'

Example output

Miss

1234567890

A -.........

B ..........

C ..........

D ..........

E ..........

F ..........

G ..........

H ..........

I ..........

J ..........

Enter coordinates (row, col), e.g. A5 =

Enter 'show' can activate backdoor cheats.

About

Simple PHP web app game

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published