Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
briscola-con-vale
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
valeria.destasio@studenti.unimi.it
briscola-con-vale
Commits
d71cb95c
Commit
d71cb95c
authored
Nov 20, 2023
by
giovanni.novati@studenti.unimi.it
Browse files
Options
Downloads
Patches
Plain Diff
VERDE: passa SmartBriscolaStrategyTest
parent
846c3e41
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/it/unimi/di/sweng/briscola/strategie/SmartBriscolaStrategy.java
+14
-2
14 additions, 2 deletions
...mi/di/sweng/briscola/strategie/SmartBriscolaStrategy.java
with
14 additions
and
2 deletions
src/main/java/it/unimi/di/sweng/briscola/strategie/SmartBriscolaStrategy.java
+
14
−
2
View file @
d71cb95c
...
...
@@ -7,12 +7,24 @@ import it.unimi.di.sweng.briscola.strategie.Strategy;
import
org.jetbrains.annotations.NotNull
;
public
class
SmartBriscolaStrategy
implements
Strategy
{
private
final
Strategy
next
;
public
SmartBriscolaStrategy
(
Strategy
next
)
{
this
.
next
=
next
;
}
@Override
public
@NotNull
Card
chooseCard
(
@NotNull
Player
me
,
@NotNull
Player
other
,
@NotNull
Suit
briscola
)
{
return
null
;
Card
briscolaMia
=
null
;
for
(
Card
card
:
me
)
{
if
(
card
.
getSuit
().
equals
(
briscola
))
briscolaMia
=
card
;
}
if
(
briscolaMia
==
null
)
return
next
.
chooseCard
(
me
,
other
,
briscola
);
for
(
Card
card
:
other
)
{
if
(
card
.
getRank
().
points
()==
0
)
return
next
.
chooseCard
(
me
,
other
,
briscola
);
}
return
briscolaMia
;
}
}
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