Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FirefighterStarter
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
NDIAYE Ousseynou
FirefighterStarter
Commits
6fd1e3d1
Commit
6fd1e3d1
authored
4 months ago
by
ousseyn01
Browse files
Options
Downloads
Patches
Plain Diff
no change
parent
3d1739f6
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#42810
passed
4 months ago
Stage: build
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/model/Firefighter.java
+4
-0
4 additions, 0 deletions
src/main/java/model/Firefighter.java
src/main/java/model/FirefighterBoard.java
+19
-4
19 additions, 4 deletions
src/main/java/model/FirefighterBoard.java
with
23 additions
and
4 deletions
src/main/java/model/Firefighter.java
+
4
−
0
View file @
6fd1e3d1
...
...
@@ -43,4 +43,8 @@ public class Firefighter {
public
void
extinguish
(
Position
position
,
Set
<
Position
>
firePositions
)
{
firePositions
.
remove
(
position
);
}
public
void
reset
(
Position
initialPosition
)
{
this
.
position
=
initialPosition
;
}
}
This diff is collapsed.
Click to expand it.
src/main/java/model/FirefighterBoard.java
+
19
−
4
View file @
6fd1e3d1
...
...
@@ -48,7 +48,6 @@ public class FirefighterBoard implements Board<List<ModelElement>> {
this
.
initialCloudCount
=
initialCloudCount
;
initializeElements
();
// Initialisation des Updaters
nextGenerationUpdater
=
new
NextGenerationUpdater
(
fire
,
clouds
,
firefighters
,
mountains
,
neighbors
);
terrainElements
=
new
ArrayList
<>();
...
...
@@ -68,7 +67,16 @@ public class FirefighterBoard implements Board<List<ModelElement>> {
clouds
=
new
ArrayList
<>();
mountains
=
new
ArrayList
<>();
Set
<
Position
>
firePositions
=
new
HashSet
<>();
terrainElements
=
new
ArrayList
<>();
// List<Position> initialFirefighterPositions = new ArrayList<>();
int
targetColumn
=
9
;
for
(
int
row
=
0
;
row
<
rowCount
;
row
++)
{
Position
position
=
new
Position
(
row
,
targetColumn
);
terrainElements
.
add
(
new
Route
(
position
));
}
for
(
int
index
=
0
;
index
<
initialCloudCount
;
index
++)
{
clouds
.
add
(
new
Cloud
(
randomPosition
(),
neighbors
));
...
...
@@ -76,8 +84,11 @@ public class FirefighterBoard implements Board<List<ModelElement>> {
for
(
int
index
=
0
;
index
<
initialFireCount
;
index
++)
firePositions
.
add
(
randomPosition
());
fire
=
new
Fire
(
firePositions
,
neighbors
);
for
(
int
index
=
0
;
index
<
initialFirefighterCount
;
index
++)
for
(
int
index
=
0
;
index
<
initialFirefighterCount
;
index
++)
{
firefighters
.
add
(
new
Firefighter
(
randomPosition
()));
}
for
(
int
index
=
0
;
index
<
initialCloudCount
;
index
++)
{
clouds
.
add
(
new
Cloud
(
randomPosition
(),
neighbors
));
}
...
...
@@ -155,13 +166,17 @@ public class FirefighterBoard implements Board<List<ModelElement>> {
}
public
List
<
Position
>
updateToNextGeneration
()
{
return
nextGenerationUpdater
.
updateToNextGeneration
();
List
<
Position
>
updatedPositions
=
nextGenerationUpdater
.
updateToNextGeneration
();
step
++;
// Incrémentation du compteur de génération
return
updatedPositions
;
//return nextGenerationUpdater.updateToNextGeneration();
}
@Override
public
void
reset
()
{
nextGenerationUpdater
.
resetStep
();
initializeElements
();
nextGenerationUpdater
.
resetStep
();
}
@Override
...
...
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