Skip to content

parallax/tech-test-2026-battleships

Repository files navigation

Parallax Battleships - Technical Test

Finished Game

Time allowed: 2 hours

Step 1 - Planning (30 minutes)

On an internal hack day, your team is tasked with creating a game, 'Parallax Battleships'. Your team has decided to split in half, with half of the team diving straight into coding a proof-of-concept, and the other half planning it out. You're in the planning group.

Task: Using the whiteboard, plan how you would build the game, discussing your thinking with us as you go. Feel free to write pseudo code.

Requirements

  • The game will have 2 players
  • Each player will have a 6x6 grid, A1 to F6
  • Each player will have 4 ships:
    • 1x four-tile
    • 2x three-tile
    • 1x two-tile
  • Battleship positions should be hardcoded in JSON files, rather than chosen by the players. Battleship positions must be different for each player
  • Ships should be able to play horizontally, vertically or diagonally (45°)
  • Players alternate in turns to attack
  • On a turn, a player enters a grid coordinate to attack. An invalid grid coordinate must show a validation error.
  • An attack will result in either: Sink or Miss. A battleship is sunk when only one of its coordinates is hit.
  • The UI must clearly indicate the result of the last attack
  • Players may attack the same grid coordinate twice, but it will use up their turn
  • The game is complete when all ships for a player are sunk

Extra notes:

  • Players usually wouldn't be able to see the other players board & ship positions, but they can for the purpose of this test
  • In Step 3, we expand the board size, but it will never be required to be more than 8x8
  • In Step 3, all grid coordinates of a ship must be hit before a battleship is sunk, but for now ships are sunk by hitting one part of the ship

Deliverables

  • Landing page that displays the board, with all ships visible to both players. UI polish is secondary to correctness.
  • A text input next to each side of the board, allowing a user to enter a grid coordinate, with an 'Attack' button. A player's Input & Button will be disabled when it is the other player's turn.
  • Once a game is complete, the UI must show which player has won, and all text inputs & buttons become disabled
  • Write unit tests regarding player turns

Step 2 - Implementation (1 hour)

Planning is done, you have a good feel for the game's mechanics. Your colleague has made some excellent progress.

Task: Use your knowledge of the game to review your colleague's code and help them finish off it off, without using AI. Write unit tests.

Note: Whilst you can't use AI generative coding, you can still use search engines at any time.

Step 3 - Finish the project, then add new Features, using AI (30 minutes)

Use AI to finish the project and discuss AI's changes with us

Note: First 10 minutes with just Copilot, then full use of AI after that

If you have time, choose from the following features to implement using AI:

  1. All grid coordinates of a ship must be hit before a battleship is sunk
  2. Randomizer button to select who has the first turn
  3. Disallow players from attacking the same grid coordinate twice
  4. Initial battleship positions are defined pre-game by the players
  5. Revert back to any move in the game
  6. Take a number between 5 and 8 as an input and adapt to that grid size, i.e. 5x5, 6x6, 7x7 on each side of the board. Still the same 4 ships.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published