Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Firefighter_LuisPARRA_YanisLOUNADI
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PARRA Luis
Firefighter_LuisPARRA_YanisLOUNADI
Commits
3d01aa5b
Commit
3d01aa5b
authored
Nov 23, 2023
by
plojolo
Browse files
Options
Downloads
Patches
Plain Diff
Ajout AbstractFireFighters
parent
0e6d3029
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/model/AbstractFireFighters.java
+3
-13
3 additions, 13 deletions
src/main/java/model/AbstractFireFighters.java
with
3 additions
and
13 deletions
src/main/java/model/FireFighters.java
→
src/main/java/model/
Abstract
FireFighters.java
+
3
−
13
View file @
3d01aa5b
...
...
@@ -3,11 +3,11 @@ package model;
import
util.Position
;
import
java.util.*
;
public
class
FireFighters
extends
AbstractElements
{
public
abstract
class
Abstract
FireFighters
extends
AbstractElements
{
public
List
<
Position
>
firefighterPositions
;
public
Fire
fire
;
public
FireFighters
(
int
columnCount
,
int
rowCount
,
Fire
fire
){
public
Abstract
FireFighters
(
int
columnCount
,
int
rowCount
,
Fire
fire
){
firefighterPositions
=
new
ArrayList
<>();
this
.
columnCount
=
columnCount
;
this
.
rowCount
=
rowCount
;
...
...
@@ -15,17 +15,7 @@ public class FireFighters extends AbstractElements{
}
public
void
nextMove
(){
List
<
Position
>
firefighterNewPositions
=
new
ArrayList
<>();
for
(
Position
firefighterPosition
:
firefighterPositions
)
{
Position
newFirefighterPosition
=
neighborClosestToFire
(
firefighterPosition
);
firefighterNewPositions
.
add
(
newFirefighterPosition
);
fire
.
extinguish
(
newFirefighterPosition
);
}
firefighterPositions
=
firefighterNewPositions
;
}
public
abstract
void
nextMove
();
protected
Position
neighborClosestToFire
(
Position
position
)
{
Set
<
Position
>
seen
=
new
HashSet
<>();
HashMap
<
Position
,
Position
>
firstMove
=
new
HashMap
<>();
...
...
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