Skip to content

Commit e100f6d

Browse files
committed
maint: Reformat
1 parent 1c06b74 commit e100f6d

2 files changed

Lines changed: 14 additions & 22 deletions

File tree

deckhandler.c

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ static pcg32_random_t rng;
4242
static const char *suits[] = {"Hearts ", "Diamonds", "Spades ", "Clubs "};
4343

4444
static const char *faces[] = {"Ace", "2", "3", "4", "5", "6", "7",
45-
"8", "9", "10", "Jack", "Queen", "King"};
45+
"8", "9", "10", "Jack", "Queen", "King"};
4646

4747
const DH_Card DH_card_back = {
4848
.face_val = DH_CARD_BACK,
@@ -54,13 +54,9 @@ const DH_Card DH_card_null = {
5454
.suit = DH_CARD_NULL,
5555
};
5656

57-
bool DH_is_card_back(DH_Card a) {
58-
return a.face_val == DH_CARD_BACK && a.suit == DH_CARD_BACK;
59-
}
57+
bool DH_is_card_back(DH_Card a) { return a.face_val == DH_CARD_BACK && a.suit == DH_CARD_BACK; }
6058

61-
bool DH_is_card_null(DH_Card a) {
62-
return a.face_val == DH_CARD_NULL && a.suit == DH_CARD_NULL;
63-
}
59+
bool DH_is_card_null(DH_Card a) { return a.face_val == DH_CARD_NULL && a.suit == DH_CARD_NULL; }
6460

6561
void DH_pcg_srand(uint64_t initstate, uint64_t initseq) {
6662
pcg32_srandom_r(&rng, initstate, initseq);
@@ -147,22 +143,18 @@ const char *DH_get_card_face(DH_Card card) { return faces[card.face_val - 1]; }
147143

148144
const char *DH_get_card_suit(DH_Card card) { return suits[card.suit]; }
149145

150-
static const char *const DH_suit_unicode[] = {
151-
[DH_SUIT_DIAMONDS] = "\u2666",
152-
[DH_SUIT_HEARTS] = "\u2665",
153-
[DH_SUIT_SPADES] = "\u2660",
154-
[DH_SUIT_CLUBS] = "\u2663"
155-
};
146+
static const char *const DH_suit_unicode[] = {[DH_SUIT_DIAMONDS] = "\u2666",
147+
[DH_SUIT_HEARTS] = "\u2665",
148+
[DH_SUIT_SPADES] = "\u2660",
149+
[DH_SUIT_CLUBS] = "\u2663"};
156150

157151
const char *DH_get_unicode_suit(DH_suit suit) {
158-
if (suit >= 0 && suit <= DH_SUIT_CLUBS)
159-
return DH_suit_unicode[suit];
160-
return "?";
152+
if (suit >= 0 && suit <= DH_SUIT_CLUBS)
153+
return DH_suit_unicode[suit];
154+
return "?";
161155
}
162156

163-
const char *DH_get_card_unicode_suit(DH_Card card) {
164-
return DH_get_unicode_suit(card.suit);
165-
}
157+
const char *DH_get_card_unicode_suit(DH_Card card) { return DH_get_unicode_suit(card.suit); }
166158

167159
const char *DH_get_card_face_str(int val) {
168160
switch (val) {

deckhandler.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
extern "C" {
1818
#endif
1919

20-
#include <stdint.h>
2120
#include <stdbool.h>
21+
#include <stdint.h>
2222

2323
/// Number of face values in a standard card deck (Ace to King).
2424
#define NUM_OF_FACES 13
@@ -29,7 +29,7 @@ typedef enum {
2929
DH_SUIT_DIAMONDS, ///< Diamonds suit
3030
DH_SUIT_SPADES, ///< Spades suit
3131
DH_SUIT_CLUBS, ///< Clubs suit
32-
DH_SUIT_MAX ///< Number of suits
32+
DH_SUIT_MAX ///< Number of suits
3333
} DH_suit;
3434

3535
/// Enumeration of card face values (Ace can be high or low).
@@ -75,7 +75,7 @@ bool DH_is_card_null(DH_Card a);
7575
* @DH_Deck
7676
* @brief Represents a full deck of 52 playing cards.
7777
*/
78-
typedef struct {
78+
typedef struct {
7979
DH_Card card[DH_CARDS_IN_DECK]; ///< Array of all cards in the deck
8080
int top_card;
8181
} DH_Deck;

0 commit comments

Comments
 (0)