Neat. Bug report: score is not preserved among reconnections. Example: I close my browser by mistake when we're 4 - 2, when I load the URL again scores are back at 0 - 0 (but the other player that not disconnected still has 4 - 2).
I need to work out how to store and validate scores in Firebase to prevent cheating (which should be possible with their security rules, I think).
1. Clients notify server they want to play a/another game
2. Clients both pick their 'answer' (spock/lizard/rock/...)
3. Server only tells what choice the other made once both players submitted
4. Server computes who wins, and updates scores accordingly
This does require a stateful server, but I don't think it's possible to make it cheat-proof with only clients.I think I can configure Firebase to validate scores based on some precondition (i.e. 'only allow this value to be increased by one if both players have chosen and declared'). Then clients would reset their choices immediately and scores would be 'locked-in' until the next victory condition is met. That will prevent basic attempts to cheat, but I need to look into the docs to see if I could be smarter about it.