https://github.com/hackyourfuture/battleship-api
https://github.com/hackyourfuture/battleship-api
Last synced: 20 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/hackyourfuture/battleship-api
- Owner: HackYourFuture
- Created: 2017-04-02T10:49:30.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-04-02T14:21:48.000Z (about 9 years ago)
- Last Synced: 2025-01-15T04:39:19.886Z (over 1 year ago)
- Language: JavaScript
- Size: 13.7 KB
- Stars: 0
- Watchers: 7
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
wss
# CONNECT
# PREPHASE
on: game starts --> move to PREPHASE {
player colour: 'green' or 'blue'
}
# STARTPHASE
emit: 'place' { locations }
emit: 'leave'
var ships = [
{'size': 5, 'location' : []},
{'size': 4, 'location' : []},
{'size': 3, 'location' : []},
{'size': 3, 'location' : []},
{'size': 2, location' : []}
];
on: 'start' --> move to FIGHTPHASE {
player turn: 'green'
}
on: 'leave' --> opponent left
# FIGHTPHASE
emit: 'attack' { location } -> response: {
hit: true/false,
sunk: true/false,
win: true/false
}
or ERROR NOT YOUR TURN
or ERROR COORDINATE ALREADY SUCK
on: 'attacked' {
hit: true/false
sunk: true/false
location: coordinate,
win: true/false
}
on: 'leave' --> opponent left
------------------------------------------