farid002 / api-thousand-game

An API Repository for Thousand Card mobile game
0 stars 0 forks source link

Implement take_talon function #2

Closed farid002 closed 6 months ago

farid002 commented 7 months ago

Function already exist with name: take_three_cards. Please rename it to take_talon. And implement the logic: Args.: player_id, game_id Returns: success or failure message

  1. Add NEW current_round_id column to game table as a foreign key which always shows the id of the latest round (please also adapt create round etc. function accordingly, to update the current_round_id in game table with the created round)
  2. take_talon(player_id, game_id) should COPY the talon cards from the current round (reachable via game.current_round_id) with given game_id, to player’s (with the given player_id) cards_init and cards_current columns
  3. If game, round (or any other issue) do not exist return failure, otherwise success message

REMARKS:

teymurov27 commented 7 months ago

@farid002 məncə funksiyanın adı take_three_cards olmalıdı. Çünkü talon dediyin şey 5 kartdan ibarətdi. Və bu funksiya talonun hamısını götürmür.

farid002 commented 7 months ago

@teymurov27 there are 24 cards in the game in total. 7 are dealt per each member, so always 3 cards are remaining and it is called “talon”. Please note that we only write our game for 3 players

teymurov27 commented 7 months ago

ahh, I thought talon was 5.

teymurov27 commented 7 months ago

@farid002 what is the difference between current_round (already exists in Game model) field and current_round_id field.

farid002 commented 6 months ago

@teymurov27 you may skip current_round_id field for now. It is not a must but nice to have. current_round is the number/count of the current (the last) round in the game (i.e. 7), however current_round_id is really a Foreign key on Game table to point to the current (the last) round row on Round table (i.e. 77873824bd3874dec487 - a uuid string)

farid002 commented 6 months ago

This branch is linked to issue Implement take_talon function.

teymurov27 commented 6 months ago

I think I've fixed everything. Checkout ASAP.

farid002 commented 6 months ago

This branch is linked to issue Implement take_talon function.