Amazon Interview Question for SDE-2s
- 1of 1 vote
How to develop a web based multiplayer chess game. There will be 2 player in each session. There will be multiple sessions.- mohapatrasandeep60 September 11, 2017 in India for no
My answer(I was not selected)
Each player will have a database with columns
user id(primary key), passwd,no of games played, won,drawn,last active time,sq1,sq2,...sq64,move made flag,pawn num, sqstart,sqend
where sq1-denotes square 1 and its value represents the pawn num in sq1
question- what all fields in database will be encrypted
question- why not others
answer-may be system admin needs to access them
question – how will u start a session between players?
Answer-When a player logs in, his last active time is updated. Each player is shown a list of last active players to chose from.Or system can arbitrarily select one.When a player is selected, he gets a request. Each player receives a list of requests from other players. He choses from one. That player gets an acknowledgement others get negative acknowledgement. If acknowledgement does not come in time then that player is dropped and another player is selected.
Question- http connection, can not send request from server. How the 2 players will send request to each other and how session will be initiated?
Question-how the game will be stored?
The 64 squares sq1,sq2,..sq64 will each store the pawn number in them. From random number calculatio, it will be decided which one is white and which one is black 1st time. When a player makes move,has made move flag will be true. The last move is stored as sqstart,sqend,pawn number. Each time a move is made check for valid move.The other player continuously polls for has made move flag to know if it is his turn
remarks- ur design is not scalable.
| Report Duplicate | Flag | PURGE
Interview Type: In-Person
Open Chat in New Window