GAME SERVER CHALLENGE: helper doc

The game can be implemented as the following API interfaces:

Note: The API is only suggestive, and you are free to design your own API if you feel it can improve the game experience.

/create
Request params

  • nick : string [optional ] || Desired nickname for the admin

Response

  • game_id : string || The game identifier to be passed to add players to the game.
  • player_id : string || A unique player identifier to be used to authenticate all requests on this user’s behalf
  • nick : string || = nick in request else a randomly generated nick. This will be visible to other players.

/join
Request params

  • nick : string [optional ] || Desired nickname for the player
  • game_id : string || The game identifier to be used to join the game.

Response

  • registered : boolean || If user successfully registered in the game.
  • player_id : string || A unique player identifier to be used to authenticate all requests on this user’s behalf
  • nick : string || = nick in request else a randomly generated nick. This will be visible to other players.

/start
Request params

  • user_id : string [optional ] || Only the admin can start the game.
  • game_id : string

Response

  • success : boolean || true if the game successfully started.
  • message : text || A message for information according to the status
  • grid: text || Empty if request was not successful

/info
Request params

  • player_id : string [optional ] || Player’s id to be used for authentication
  • game_id : string

Response

  • game_status : string/enum || One of [“Waiting”, “In Play”, “Completed”]
  • current_player : string || Player nick whose turn it is.
  • turn_seq: string[] || Sequence of turns starting from current player
  • words_done : string[] || List of words identified till now.
  • scores: hash || mapping of nicks with their scores.
  • grid: text || The game grid.

/play
Request params

  • word : string [optional ] || The word, identified by the user in the grid. User can pass by sending “” in word.
  • player_id : string || User’s id.
  • game_id: string

Response

  • success : boolean || The word submitted was eligible and it was the user’s turn.
  • score : int || Points awarded to the user.

Assumptions you can make:

  • No player leaves in between the game, and hence no standstill in the game.
  • There is no time limit for a user to respond.

This is the minimal implementation required to complete the test. You can try adding more features for brownie points!
Suggested features:

  • Make the game playable from a web page.
  • Have websockets in the UI, instead of (long) polling.
  • Add more options to the game (admin defined grid size, more users allowed)
  • More directions to match words.

Open your box of creativity and add more features to it !