Guest User

Untitled

a guest
Dec 7th, 2021
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.71 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdbool.h>
  3. #include "card.h"
  4.  
  5. Card card_constructor(void) {
  6.    return (Card){0};
  7. }
  8. void card_initialize(Card* this, int value, int color, int seed) {
  9.     card_set_value(this, value);
  10.     card_set_color(this, color);
  11.     card_set_seed(this, seed);
  12. }
  13.  
  14. void card_print_values(Card* this) {
  15.     printf("Value: %d\tColor: %d\tSeed: %d\n", this->value, this->color, this->seed);
  16. }
  17.  
  18. bool card_is_valid(Card* this) {
  19.     if (this->seed > 0 && this->seed < 5 &&
  20.         this->value > 0 && this->value < 14 &&
  21.         this->color > 0 && this->color < 5)
  22.         return true;
  23. }
  24.  
  25. void card_reset_values(Card* card) {
  26.     card->color = 0;
  27.     card->seed = 0;
  28.     card->value = 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment