Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Enchente
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Vytor Calixto
Enchente
Commits
0573f672
There was a problem fetching the pipeline summary.
Commit
0573f672
authored
8 years ago
by
Vytor Calixto
Browse files
Options
Downloads
Patches
Plain Diff
Add função pra calcular bonus no .h
parent
0afea0d7
No related branches found
No related tags found
No related merge requests found
Pipeline
#
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
libs/jogador.c
+12
-12
12 additions, 12 deletions
libs/jogador.c
libs/jogador.h
+2
-0
2 additions, 0 deletions
libs/jogador.h
with
14 additions
and
12 deletions
libs/jogador.c
+
12
−
12
View file @
0573f672
...
@@ -42,18 +42,6 @@ Lista filhosGrupo(Lista grupoPai) {
...
@@ -42,18 +42,6 @@ Lista filhosGrupo(Lista grupoPai) {
return
filhos
;
return
filhos
;
}
}
int
calculaBonus
(
Vertice
v
,
Lista
filhos
)
{
int
bonus
=
0
;
for
(
No
n
=
primeiroNoLista
(
v
->
filhos
);
n
;
n
=
getSucessorNo
(
n
))
{
Vertice
filho
=
getConteudo
(
n
);
// Se o filho não está na lsita filhos e não está no grupo de vértices já consumidos
if
(
!
pertenceLista
(
filho
,
filhos
)
&&
!
filho
->
grupo
)
{
bonus
+=
filho
->
peso
;
}
}
return
bonus
;
}
Lista
agrupaCores
(
Lista
filhos
)
{
Lista
agrupaCores
(
Lista
filhos
)
{
Lista
agrupa
=
constroiLista
();
Lista
agrupa
=
constroiLista
();
for
(
No
n
=
primeiroNoLista
(
filhos
);
n
;
n
=
getSucessorNo
(
n
))
{
for
(
No
n
=
primeiroNoLista
(
filhos
);
n
;
n
=
getSucessorNo
(
n
))
{
...
@@ -81,3 +69,15 @@ Lista agrupaCores(Lista filhos) {
...
@@ -81,3 +69,15 @@ Lista agrupaCores(Lista filhos) {
return
agrupa
;
return
agrupa
;
}
}
int
calculaBonus
(
Vertice
v
,
Lista
filhos
)
{
int
bonus
=
0
;
for
(
No
n
=
primeiroNoLista
(
v
->
filhos
);
n
;
n
=
getSucessorNo
(
n
))
{
Vertice
filho
=
getConteudo
(
n
);
// Se o filho não está na lsita filhos e não está no grupo de vértices já consumidos
if
(
!
pertenceLista
(
filho
,
filhos
)
&&
!
filho
->
grupo
)
{
bonus
+=
filho
->
peso
;
}
}
return
bonus
;
}
This diff is collapsed.
Click to expand it.
libs/jogador.h
+
2
−
0
View file @
0573f672
...
@@ -14,4 +14,6 @@ Lista filhosGrupo(Lista grupoPai);
...
@@ -14,4 +14,6 @@ Lista filhosGrupo(Lista grupoPai);
// Retorna uma lista de vértices com as cores e pesos agrupadas a partir de l
// Retorna uma lista de vértices com as cores e pesos agrupadas a partir de l
Lista
agrupaCores
(
Lista
filhos
);
Lista
agrupaCores
(
Lista
filhos
);
int
calculaBonus
(
Vertice
v
,
Lista
filhos
);
#endif
#endif
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