shtwzrd / battlechat Goto Github PK
View Code? Open in Web Editor NEWA simple web-based Battleship client/server
Home Page: https://battlechat-dev.herokuapp.com
License: GNU General Public License v3.0
A simple web-based Battleship client/server
Home Page: https://battlechat-dev.herokuapp.com
License: GNU General Public License v3.0
As a Stakeholder,
I would like to be sure that the server can handle at least 16 simultaneous games,
so that at least 32 people can play Battleship simultaneously
Acceptance test | |
---|---|
Prerequisites | The server is started |
Expected Input | At least 16 matches are in progress |
Expected Output | The service remains responsive |
Currently, the root directory of the application returns Not Found. The index page, used to queue into a game, should be served up when user HTTP GET to /
As a Player,
I would like to be able to place my Battleships at the start of the match,
so that I have control over the arrangement of my fleet.
Acceptance test | |
---|---|
Prerequisites | Phase 1 of the game has started, and Player has chosen a ship to place |
Expected Input | Player chooses a square to place the ship |
Expected Output | Ship appears at the selected square |
As a Player,
I would like to have the ability to communicate with my opponent,
so that I can say rude things to him.
Acceptance test | |
---|---|
Prerequisites | Player is in a game |
Expected Input | Player writes a message and sends it |
Expected Output | message shows in chat for all participants |
As a client-side developer,
I would like for the server to return informative error messages when I issue requests that cannot be honored,
so that debugging front-end development is not opaque.
Acceptance test | |
---|---|
Prerequisites | It's not the player's turn |
Expected Input | Client code sends a firing GameMessage |
Expected Output | The Server sends an Error GameMessage that explains that it wasn't the player's turn |
The client needs some understanding of what qualifies as a valid placement of battleships, so that it can provide the user with immediate feedback about invalid placements, or disallow them entirely, allowing for a better user experience.
This also prevents the server from having to validate individual ship placements all the time, reducing load.
As a Player,
I would like to be able to ignore the other player’s chat messages,
so that they can’t hurt my feelings.
Acceptance test | |
---|---|
Prerequisites | The player is in a match |
Expected Input | The player clicks a button or inputs a command indicating they would like to ignore their opponent |
Expected Output | The game no longer displays messages from the other player |
As a Player,
I would like the possibility to give up(forfeit/surrender) a match,
so that I'm not forced to play through a one-sided match.
Acceptance test | |
---|---|
Prerequisites | It's the player's turn |
Expected Input | Player clicks a button or enters a command indicating they'd like to forfeit the game |
Expected Output | The match is over and the other player wins |
Figure out what the data looks like for the models sent over the wire
Needs:
Ship-placement models (sent Client to Server)
Firing models (sent Client to Server)
Valid firing locations (sent Server to Client)
Ship listings (sent Server to Client, at start of placement phase)
Game status messages (sent Server to Client, to inform Client of placement versus playerX firing turn, player Y firing turn, player X win, player Y win, etc)
Chat messages (sent Client to Server, then Server to Clients)
As a Player,
I would like there to be a time limit on moves,
so that I don’t have to wait til the end of time for a slow opponent.
Acceptance test | |
---|---|
Prerequisites | Player has their turn |
Expected Input | Player does not make a move for 60 seconds |
Expected Output | The player's turn is skipped and it becomes the other player's turn |
As a Player,
I would like to be notified when I win or lose,
so that I know when the game is over.
Acceptance test | |
---|---|
Prerequisites | A game has been played to completion, meaning that one player no longer has any ships |
Expected Input | A state representing a completed game |
Expected Output | The game displays a notification indicating who won, and no longer accepts firing commands |
As a Player,
I would like the game to respond to my actions in less than 2 seconds most of the time,
so that the game feels responsive and not frustrating.
Acceptance test | |
---|---|
Prerequisites | Player is in a game |
Expected Input | Player performs some action, such as attempting to fire on a square |
Expected Output | The game returns some form of feedback with a maximum of 2 seconds, on average |
We need to represent the data within a game session. We diagramed the object model on a whiteboard and came up with the following classes:
Game State
Board
Player
View
Fleet
Ship
@iensenfirippu is assigned.
As a Player,
I would like to be able to rotate a ship I place,
so that I can hide my submarines even better.
Acceptance Test | |
---|---|
Prerequisites | Player has placed or is placing a ship |
Expected Input | Player chooses to rotate the ship |
Expected Output | If the ship was oriented horizontally, it is now vertical. Or the inverse. |
As a Player,
I would like to see a log over the moves made,
so that I can keep track of my enemy's actions.
Acceptance test | |
---|---|
Prerequisites | At least one Event has occurred |
Expected Input | An Event, such as a ship placement or a firing command |
Expected Output | The result of the Event is written visibly to the screen, eg. "Player 1 fired at G5: MISS" |
Configure Spark to render mustache templates
@WarreQ is assigned.
As a Player,
I would like assurance that only one player can fire at a time,
so that the rules of the game are enforced.
Acceptance test | |
---|---|
Prerequisites | The placement phase of the game is complete |
Expected Input | Player attempts to fire when it is the other player's turn |
Expected Output | The action is not allowed |
As a Player,
I would like to be able to easily choose a target to fire at in the combat round,
so that I have control over where my fleet fires.
Acceptance test | |
---|---|
Prerequisites | Phase 2 of the game has started |
Expected Input | Player clicks where they'd like to fire |
Expected Output | Game displays the square as either a hit or a miss and marks it |
The server needs to maintain a collection of sessions.
When a player joins a game, there are two possibilities:
The server should render the HTML client-side for the initial state of the game, including any databinding necessary for the client-side.
The chosen templating language is Mustache, so the template should be defined in that.
@ThorOfDoom is assigned.
As a Player,
I would like to be able to access the game via my web browser,
so that I can easily play from anywhere, without needing to install any special software.
Acceptance test | |
---|---|
Prerequisites | The server is running, Player has a web browser and an internet connection |
Expected Input | The Player navigates to the URL for the Battlechat service |
Expected Output | Page loads and the Player is able to enter a game |
When on the root page, the player should be able to press a button or similar that allows them to queue into a game.
This should issue an HTTP POST to /, which returns the Battleship game page and redirects the user's browser there.
The server-side code needs to implement domain knowledge of what a valid ship configuration looks like.
The rules are as follows:
When a session contains two people, the server should send a message to both players that the game is beginning and the server will then become receptive to ship placement commands.
As a Player,
I would like to be able to see where my shots have hit the enemy,
so that I can keep track of the enemy ships my fleet has hit.
Acceptance test | |
---|---|
Prerequisites | Player has fired at least one shot that was a hit and one shot that was a miss |
Expected Input | A game state in which the above prerequisite is met |
Expected Output | The square that was hit and the square that was a miss are visually distinguishable |
As a Player,
I would like to be able to see where my fleet has already shot at,
so that I can keep track of where to shoot next and avoid wasting shots.
Acceptance test | |
---|---|
Prerequisites | Player has fired at least one shot |
Expected Input | Player chooses to fire their shot on a square that they've already hit |
Expected Output | The ability to select that square is disabled |
Make a plain html page to test the client-side code on, for quicker iteration in UI design and ease of client-side code testing.
@TheMightyMarm is assigned.
When the client has finished placing their ships onto the board, the configuration of ships should be POSTed to the server (via /session//placement or similar), and the server should return HTTP Status Code 200 if it's valid or 400 if invalid.
If the configuration is valid, the server's gamestate should be updated accordingly.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.