You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 7, 2020. It is now read-only.
We would like to know if a game state is valid. A valid game state means that given a 2D array representing game pieces, those pieces could have actually been created by two players following the rules of the game (alternating turns dropping pieces).
Functional Requirements:
Create a new POST route /validate
The route should accept a 2D array of game pieces just as they the /save API end point does.
If the game board is valid, the server should respond 200 OK with message "Board is valid!"
If the game board is NOT valid, the server should respond 200 OK with the message "This board is messed up!"
For this issue, a board should be considered valid if:
Each game piece has other game pieces below it (no floating pieces)
Counting each game piece shows that Player 1 has N or N+1 game pieces on the board, where N is the number of game pieces Player 2 has on the board.
We would like to know if a game state is valid. A valid game state means that given a 2D array representing game pieces, those pieces could have actually been created by two players following the rules of the game (alternating turns dropping pieces).
Functional Requirements:
For this issue, a board should be considered valid if:
Example of a valid game board:
[[null, null, null, null, null, 1 ],
[null, null, null, null, 1, 2 ],
[null, null, null, null, null, 2 ],
[null, null, null, null, 1, 2 ],
[null, null, null, 2, 1, 1 ],
[null, null, null, null, null, null ],
[null, null, null, null, 1, 2 ]]
Examples of invalid game board:
[[null,null,null,null,null,1],
[null,null,null,null,null,2],
[null,null,null,2,1,1],
[null,null,2,2,1,2],
[null,null,null,null,null,2],
[null,null,null,null,null,null],
[null,null,null,null,null,null]]
The text was updated successfully, but these errors were encountered: