How can I calculate with Firebase?

406 views
Skip to first unread message

Luong Andy

unread,
Jul 4, 2016, 11:15:45 AM7/4/16
to Firebase Google Group
For instance, I have a caro game play offline (human vs bot), but now I wanna use firebase as a server to make it online (human vs human), but I dont know "How to calculate score, how many math did they join or how many math did they win/lose"?
Might someone show to how to do that?

Joe White

unread,
Jul 4, 2016, 3:16:25 PM7/4/16
to Firebase Google Group
Luong --
You might benefit by thinking of Firebase Realtime Database as a shared "notepad" for information (one that can be watched and an event triggered whenever the watched "thing" changes).

You could structure your database so that you have information about users (keep ID, win/loss, games currrently involved in,..), games (players in game, current position, current user to play, ...).  You might have your clients, during a game, ensuring that only the player "to play" can make a move, and having the other "waiting" player watch for change (and noting when it is their move).  If you are playing real-time and whenever each user logs in .. handline GoMoku/Caro play across timezines) this should work.

Make sense?
Reply all
Reply to author
Forward
0 new messages