Interface List

Client Methods:

Method Description Reqs
Satified
void gameChanged(Hint hint) The feedback from the server to the client that the game has changed, and the client needs to update its local game.
How is has changed is described in the hint object
2, 3, 8, 9

Server Methods:

Method Description Reqs
Satified
Exceptions
Game createGame(int NumberOfPlayers, Player creator) This method is called by the player (client) to create a new game in the game room. The method must create a new game, assign a board to it and add the creator to the list of players that are assigned to the game. The new game will be stored in the DB. The method returns the created Game to the player. 5, 6, 8 IncorrectNumberOfPlayers When the number of players is not between 2 and 5 (inclusive).
MaximumGamesExceded When the number of current games reach more than 100.
IllegalCreator When the information of the player that creates the game is not correct.
GameCreationException When there is an error in creating the game.
void joinGame(Game existingGame, Player newPlayer) This method is used by the player (client) when he or she wants to join an existing game in the game room. The server must add the player to the list of players assigned to the game. The list of players is updated in the DB. 1, 4, 7 UnknownGame When the game that is sent as a parameter does not exist.
FullGame When the game that is sent as a parameter has no more available player spots.
PlayerAlreadyInGame When the player tries to join a game more than once.
UnknownPlayer When the information of the player that joins the game is not correct.
GameJoinException When there is an error in updating the game.
Game[] listGames(int type) Method used to find the games that are currently available in the game room. The server will filter the games according to a type, that could be all unstarted games, and all games of only 2, 3, 4 or 5 players. This method does not change state, as it only queries the DB. 6 ListGamesException When there is an error when obtaining the list of games.
void joinGameRoom(Player newPlayer) This method is used to let the server know that a new client has joined the game room. 1, 5, 6, 7 IllegalPlayer When he information of the player that joins the gameroom is not correct.
GameRoomJoinException When there is an error in updating the game room.
boolean fillNumber(int number, int square, Game currentGame, Player player) The player will use this method to tell the server that a box in the Sudoku board is being filled with a certain number. The server will find out if the number is correct and change the players' scores accordingly. The server must notify all the clients that are in the game of the change in the board and scores. The server returns the result (correct or incorrect) to the player that made the change in the board. 2, 3, 4, 9 UnknownGame When the game that is sent as a parameter does not exist.
IllegalMove When the number is not between 1 and 9 (inclusive) or the square is not between 1 and 81 (also inclusive).
IllegalGame When the player is not assigned to the game.
UnknownPlayer When the information of the player that joins the game is not correct.
FillNumberException When there is an error in updating the game or calculating the scores.

Game Database:

Method Description Reqs
Satified
Exceptions
Board getNewBoard() Returns a new Board from the game database. The class will keep track of what board have been played
recently and it will return a board that has not been played recently.
6, 7 GetBoardException When there is an error getting a new board