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
692f14a1
There was a problem fetching the pipeline summary.
Commit
692f14a1
authored
7 years ago
by
Vytor Calixto
Browse files
Options
Downloads
Patches
Plain Diff
Melhorando função que dá bônus
parent
497a0827
No related branches found
No related tags found
1 merge request
!2
Altura
Pipeline
#
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libs/jogador.c
+19
-17
19 additions, 17 deletions
libs/jogador.c
with
19 additions
and
17 deletions
libs/jogador.c
+
19
−
17
View file @
692f14a1
...
...
@@ -151,7 +151,23 @@ void calculaBonus(Lista grupo, Grafo g, int profundidade) {
}
}
Lista
vFilhos
=
agrupaCores
(
v
->
filhos
);
v
->
bonus
+=
tamanhoLista
(
v
->
filhos
)
-
tamanhoLista
(
vFilhos
);
v
->
bonus
+=
(
tamanhoLista
(
v
->
filhos
)
-
tamanhoLista
(
vFilhos
))
*
2
;
// TODO: Se os filhos do grupo vão acabar na próxima jogada, dar bonus
// tabuleiro 3 3 4 1930
for
(
No
m
=
primeiroNoLista
(
vFilhos
);
m
;
m
=
getSucessorNo
(
m
))
{
Vertice
w
=
(
Vertice
)
getConteudo
(
m
);
int
somaCor
=
0
;
for
(
No
o
=
primeiroNoLista
(
g
->
vertices
);
o
;
o
=
getSucessorNo
(
o
))
{
Vertice
x
=
(
Vertice
)
getConteudo
(
o
);
if
(
x
->
grupo
)
continue
;
if
(
x
->
cor
==
w
->
cor
)
{
somaCor
+=
x
->
peso
;
}
}
if
(
w
->
peso
==
somaCor
)
{
w
->
bonus
+=
150
;
}
}
destroiLista
(
vFilhos
,
NULL
);
int
menorDistancia
=
v
->
altura
;
...
...
@@ -184,8 +200,9 @@ void calculaBonus(Lista grupo, Grafo g, int profundidade) {
// for igual ao peso do vértice agrupado, esta é a
// última jogada com aquela cor
if
(
v
->
peso
==
somaCor
)
{
v
->
bonus
+=
10
0
;
// Mais bonus para que essa cor seja a escolhida
v
->
bonus
+=
25
0
;
// Mais bonus para que essa cor seja a escolhida
}
}
return
;
...
...
@@ -198,21 +215,6 @@ int calculaBonusRec(Vertice v, Vertice pai, Grafo g, int profundidade) {
Vertice
filho
=
(
Vertice
)
getConteudo
(
n
);
if
((
filho
->
altura
>
v
->
altura
))
{
int
preBonus
=
filho
->
peso
+
calculaBonusRec
(
filho
,
v
,
g
,
profundidade
-
1
);
// for(No m = primeiroNoLista(g->vertices); m && (profundidade < 10); m = getSucessorNo(m)) {
// Vertice w = (Vertice) getConteudo(m);
// if(w == pai) continue;
// if(!w->grupo) {
// // Se existe alguém um nível acima da mesma cor...
// if((w->altura == (filho->altura - 1)) && (w->cor == filho->cor)) {
// // preBonus += 25;
// }
// // // Se existe alguém dois níves acima com a mesma cor
// // else if((w->altura == (filho->altura - 2)) && (w->cor == filho->cor)) {
// // preBonus += 15;
// // }
// }
// }
bonus
+=
preBonus
;
}
}
...
...
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