-
Notifications
You must be signed in to change notification settings - Fork 2
/
TODO.txt
30 lines (22 loc) · 1.85 KB
/
TODO.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Implement battle ship for web.
................................................................
Server will be responsible for serving the required data to the player.
................................................................
create a game object which have two object namelly player_1 and player_2.
................................................................
each player has following properties
==> name - it contains the name of player)
==> fleet - (fleet is collection of ships that is 5 ship)
ship will also be an object which has two own properties
namelly name and holes. It also has some properties which
will be inherited from the Ship constructor function.
==> usedPositions - it contains the information about all those
positions which occupied by all the ship have been deployed till now.(it should have in prototype of players)
==>shoot - It is a behaviour. Player should invoke it whenever he
wants to shoot his opponent ship. Within the shoot their will be few events
as "HIT", "MISSED" and "YOUR TURN" and depending on each of these events
server will take some decision how and what data it has to serve to player.
On the event of "MISSED" a callback function will be invoked which will inform the player itself that the particular position had got hit and can't be hit anymore.
On the event of "HIT" a callback function will be invoked which will check which ship of opponent got hit and inform the opponent about it and also inform the player itself that the particular position had got hit and can't be hit anymore.
(it should have in prototype of players)
and after each of the events "HIT" or "MISSED" an another event "YOUR TURN" will be generated. And on the event of "YOUR TURN" the server will inform the opponent that this your turn and disable the previous player from hiting his opponent untill the opponent playe his turn.