Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
paciencia
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Harbor Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Matheus Rotondano De Camargo
paciencia
Commits
ea285411
Commit
ea285411
authored
8 years ago
by
Matheus Rotondano De Camargo
Browse files
Options
Downloads
Patches
Plain Diff
Upload new file
parent
38d16a67
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/baralho.h
+61
-0
61 additions, 0 deletions
src/baralho.h
with
61 additions
and
0 deletions
src/baralho.h
0 → 100644
+
61
−
0
View file @
ea285411
#ifndef H_BARALHO_H
#define H_BARALHO_H
#include
<stdio.h>
#include
<stdlib.h>
#include
<strings.h>
#include
<time.h>
#define NAIPES 4
#define CARTAS 13
#define MAGIC_LEN 4
/* 2 letras, 1 '\n', 1 '\0' */
#define PPMEXT "ppm"
static
char
vals
[
13
]
=
{
'A'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'D'
,
'J'
,
'Q'
,
'K'
};
static
char
naipes
[
4
]
=
{
'P'
,
'C'
,
'E'
,
'O'
};
int
load
;
FILE
*
ENTRADA
;
typedef
struct
{
unsigned
char
R
,
G
,
B
;
}
Pixel
;
typedef
struct
{
char
valor
,
naipe
;
/* É necessário alocar o espaço da imagem.
img é um ponteiro para um vetor que guarda os dados
da carta (pixels), com exceção do cabeçalho. */
Pixel
*
img
;
}
Carta
;
typedef
struct
{
char
magic
[
MAGIC_LEN
];
int
w
,
h
,
maxval
;
}
Cabecalho
;
/* Baralho é do tipo Carta**, o baralho é uma matriz de cartas.
É a imagem original com "recortes" nas cartas. */
typedef
Carta
**
Baralho
;
/* Enquanto Baralho é a imagem original "recortada", Monte são as
as cartas propriamente ditas empilhadas, porem sem a imagem. */
typedef
char
**
Monte
;
typedef
struct
tm
tm
;
Cabecalho
cabeca
;
Carta
NADA
;
Baralho
init
(
char
*
imgFile
,
int
cw
,
int
ch
,
char
primCarta
,
char
*
ordNaipes
);
Baralho
geraBaralho
(
Baralho
cartas
);
Carta
getCarta
(
char
naipe
,
char
valor
,
Baralho
cartas
);
void
geraCarta
(
char
naipe
,
char
valor
,
Baralho
cartas
);
Monte
criaMonte
(
int
n
);
Carta
tiraCarta
(
Monte
deck
,
Baralho
bar
);
Monte
colocaCarta
(
int
n
,
Carta
c
,
Monte
deck
);
void
troca
(
Monte
deck
,
int
i
,
int
ir
);
Monte
embaralha
(
Monte
deck
);
#endif
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment