1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
#ifndef SERVER_GAME_PROCESS_H_SENTRY
#define SERVER_GAME_PROCESS_H_SENTRY
#include "card_stack.h"
#include "server.h"
#include "card_queue.h"
enum {
start_deck_size = 6
};
struct game_info {
int players_number;
int *card_quantity_arr;
int shuffled_cards_left;
const char* trump_card;
int position_whose_turn;
struct cards_on_table *cot;
struct card_queue *cq;
};
const char** get_shuffled_deck();
void deal_first_cards(const char **shuffled_deck, int *cards_left,
player_cards *deck);
void deal_cards(const char **shuffled_deck, int *shuffled_cards_left,
struct session **turn_queue, int turn_queue_size,
int *number_arr);
void deal_one_card_in_turn(const char **shuffled_deck, int *shuffled_cards_left,
struct session **turn_queue, int turn_queue_size,
struct card_count cc);
const char* extract_trump_card(const char **shuffled_deck, int *cards_left);
int find_lowest_trump(player_cards deck, const char *trump);
void shift_turn_queue_by_one(struct session **turn_queue, int turn_queue_size);
void move_turn_queue_two_players_ahead(struct session **turn_queue,
int turn_queue_size);
void update_card_quantity_arr(struct session **turn_queue,
struct card_count cc);
struct game_info* get_new_game_info(int players_number, int *card_quantity_arr,
int shuffled_cards_left,
const char *trump_card,
int position_whose_turn,
struct card_queue *cq,
struct cards_on_table *cot);
int is_card_beat(const char *attack_card, const char *defend_card,
const char *trump_suit);
int check_defender_can_defend(struct card_queue *cq, player_cards deck,
const char *trump_suit);
void update_game_info(struct game_info *gi, int players_number,
int shuffled_cards_left, int position_whose_turn);
int check_someone_can_toss_card(struct session **turn_queue,
int players_quantity, struct card_queue *cq,
struct cards_on_table *cot);
int check_player_can_toss_card(player_cards deck, struct cards_on_table *cot);
int is_correct_tossing_card(const char *card, struct cards_on_table *cot);
void put_all_cards_from_queue_to_table(struct cards_on_table *cot,
struct card_queue *cq);
void put_one_card_from_queue_to_table(struct cards_on_table *cot,
struct card_queue *cq);
void put_defender_card_on_table(struct cards_on_table *cot, const char *card);
void move_all_cards_to_defender(struct cards_on_table *cot, player_cards *deck);
void remove_cards_from_table(struct cards_on_table *cot);
int calculate_defense_card_quantity_on_table(const struct cards_on_table *cot);
int calculate_attack_card_quantity_on_table(const struct cards_on_table *cot);
int check_all_answers_were_received(const struct session **turn_queue,
int turn_queue_size);
int is_receiving_cards_limit(const struct cards_on_table *cot,
player_cards defense_deck,
const struct card_queue *cq);
void clear_defense_lost_status(struct session *defender);
int check_everyone_can_replanish_deck(int shuffled_cards_left,
struct session **turn_queue,
int turn_queue_size, int *number_arr);
#endif
|