This repository was archived by the owner on Jan 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdeck.h
81 lines (70 loc) · 1.57 KB
/
deck.h
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
#ifndef DECK_H
#define DECK_H
#include <stdlib.h>
#include "player.h"
#include "card.h"
/*
* Structure: deck
* ---------------
* An array of 52 cards.
*/
struct deck {
struct card list[52];
int top_card;
};
//int deck_length=sizeof(list)/sizeof(list[0]);
/*
* Variable: deck_instance
* -----------------------
*
* Go Fish uses a single deck
*/
struct deck deck_instance;
/*
* Function: shuffle
* --------------------
* Initializes deck_instance and shuffles it.
* Resets the deck if a prior game has been played.
*
* returns: 0 if no error, and non-zero on error
*/
int shuffle();
/*
* Function: deal_player_cards
* ---------------------------
* Deal 7 random cards to the player specified in the function.
* Remove the dealt cards from the deck.
*
* target: pointer to the player to be dealt cards
*
* returns: 0 if no error, and non-zero on error
*/
int deal_player_cards(struct player* target);
/*
* Function: next_card
* -------------------
* Return a pointer to the top card on the deck.
* Removes that card from the deck.
*
* returns: pointer to the top card on the deck.
*/
struct card* next_card( );
/*
* Function: size
* --------------
* Return the number of cards left in the current deck.
*
* returns: number of cards left in the deck.
*/
size_t deck_size( );
/*
* Function: initializeDeck
* ------------------------
* Initialize the deck to keep the function shuffle() manageable
*
* returns: 0 if no error, and non-zero on error
*/
int initializeDeck();
int shuffleRand();
int moveCards(int numbers[]);
#endif