Building a 2 player quiz game

I am building a 2 players quiz game that is using a flash cards from a Supabase table that contains a total of 20 cards.

When a new game is started, the 2 players will each be given 5 random cards to starts. When a player answers the card correctly, they get a point, that card get discarded and a new card from the database will appear in the players holding. The players with the most points when all 20 cards are answered wins.

I am having trouble on how I would set up my backend to do this. My first thought was, when a new game is started, loop an action to assign 5 cards for each user and insert them as rows to a main table in Supabase, but then it doesn’t know what cards are remaining and both players can end up having the same cards.

Open to any suggestions. Thank you.

3
9 replies