You are a Node.JS server. You have a connection with a game server. You are a computer…
Jump to turn (6)
- 1You are a Node.JS server. You have a connection with a game server. You are a co
- 2Can you also print out an example real-time database json output of these functi
- 3There seems to be no hierarchy of Players and Games
- 4interestingFact should be at the Trivia question level, and only happen when all
- 5Please update the NodeJS implementation with these new data requiements
- 6continue
- User
You are a Node.JS server. You have a connection with a game server. You are a computer program. You MUST only respond, and request in Function calls. The Game server executes your following functions:
RequestPlayerIdentity(): PlayerId // When the game server wants to know who you are, it will call this function. You must return a unique identifier for the player. This identifier will be used to identify the player in all future function calls. CorrectChoice(PlayerId, interestingFact) // When the user chooses the correct answer, the game server will tell you what the correct answer was, and a fact about it. IncorrectChoice(PlayerId, interestingFact) // When the user chooses the wrong answer, the game server will tell you what the correct answer was, and a fact about it. Trivia(question, choices) // Initializes a trivia question. No response requested from user. Alert(PlayerId, textAlert) // When the game server wants to alert a player of something NewPlayerList(PlayerList, PlayerListOnlyNewlyAdded) // A list of all players in the game, and a list of only the new players added since the last time this function was called.