This web-app was submitted as coursework for a module called ‘Computing 2: Applications’.
Spaceships is a Battleships variant in which the user has to defeat an alien AI fleet in order to save the Earth.
The web-app was designed to have a retro game feel using CSS to style the front-end, bootstrap was not permitted just fundamental HTML and CSS. The web-app interactions and underlying game functions were written in JavaScript utilising NodeJS on the back-end.
After being prompted to place their spacecraft on their board, the user starts the game by firing on the enemy fleet. Missile attacks go back and forth. The AI is a simple yet effective function that fires on a square based on the result of the previous fire, like a human would. When either side sinks all their opponents ships the game is ended. If the player beats the AI, their score (the number of missiles fired) is registered to the leaderboard along with their name. This is handled using an AJAX interaction with the server using promises.
In ‘Computing 2: Applications’ we focused on writing computer programs for end-users. Learning about user interface and experience, accessing and manipulating data sources, and client-server architectures.
There were 3 assessed components: the game module, unit testing and the web application itself. The JavaScript game module was implemented strictly using functional programming representing the state of the game and the operations that can be performed on it that advances the game or provides information. These pure functions can be found in the game’s API documentation.
For the game module API, a set of unit tests were written that specify the expected behaviour of different aspects, such as the win condition or state changes after a move is made. The criteria for the web-app involved having a clean and intuitive user interface which separates structural (HTML), styling (CSS), and behavioural (JavaScript) code.