Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tarot
tarot
Commits
360234b3
Commit
360234b3
authored
Oct 12, 2019
by
Vivien Kraus
Browse files
Refuse to impute a game if it leads to a petit sec.
parent
5f64c57d
Pipeline
#174968
failed with stages
in 80 minutes and 57 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/libtarot/counter/tarot/counter_private_impl.h
View file @
360234b3
...
...
@@ -653,6 +653,25 @@ counter_and_game_impute (TarotCounter * counter,
}
if
(
energy
<
0
.
5
)
{
TarotPlayer
owners
[
78
];
for
(
i
=
0
;
i
<
78
;
i
++
)
{
owners
[
i
]
=
(
TarotPlayer
)
(
-
1
);
}
for
(
i
=
0
;
i
<
current_solution
.
n_remaining
;
i
++
)
{
c
=
current_solution
.
cards
[
i
].
card
;
p
=
current_solution
.
cards
[
i
].
assigned
;
assert
(
owners
[
c
]
==
(
TarotPlayer
)
(
-
1
));
owners
[
c
]
=
p
;
}
for
(
i
=
TAROT_PETIT
+
1
;
i
<=
TAROT_TWENTYONE
&&
owners
[
i
]
!=
owners
[
TAROT_PETIT
];
i
++
)
;
if
(
i
>
TAROT_TWENTYONE
)
{
return
TAROT_IMPUTATION_FAILED
;
}
for
(
i
=
0
;
i
<
current_solution
.
n_remaining
;
i
++
)
{
c
=
current_solution
.
cards
[
i
].
card
;
...
...
@@ -672,7 +691,7 @@ counter_and_game_impute (TarotCounter * counter,
if
(
game_assign_missing_card
(
game
,
c
,
p
)
!=
0
||
counter_assign_missing_card
(
counter
,
c
,
p
)
!=
0
)
{
assert
(
0
)
;
return
TAROT_IMPUTATION_FAILED
;
}
}
else
if
(
p
==
TAROT_COUNTER_CARD_OWNER_DISCARDED
)
...
...
@@ -681,7 +700,7 @@ counter_and_game_impute (TarotCounter * counter,
if
(
game_assign_missing_card
(
game
,
c
,
p
)
!=
0
||
counter_assign_missing_card
(
counter
,
c
,
p
)
!=
0
)
{
assert
(
0
)
;
return
TAROT_IMPUTATION_FAILED
;
}
}
}
...
...
src/libtarot/hands/tarot/hands_private_impl.h
View file @
360234b3
...
...
@@ -171,6 +171,10 @@ hands_assign_missing_card (TarotHandsHandle * hands, TarotCard card,
if
(
error
==
0
&&
hand_size
(
&
(
hands
->
hands
[
player
]))
>=
n_remaining
)
{
hands
->
known
[
player
]
=
1
;
if
(
hand_has_petit_sec
(
&
(
hands
->
hands
[
player
])))
{
error
=
1
;
}
}
return
error
;
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment