Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Game of life Toullec
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
TOULLEC Romain
Game of life Toullec
Commits
b85d5d3d
Commit
b85d5d3d
authored
5 months ago
by
TOULLEC Romain
Browse files
Options
Downloads
Patches
Plain Diff
ajout de state et SubMatrixInitializer
parent
78c69d96
No related branches found
No related tags found
No related merge requests found
Pipeline
#38390
failed
5 months ago
Stage: build
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/matrix/SubMatrixInitializer.java
+16
-0
16 additions, 0 deletions
src/main/java/matrix/SubMatrixInitializer.java
src/main/java/model/State.java
+8
-3
8 additions, 3 deletions
src/main/java/model/State.java
with
24 additions
and
3 deletions
src/main/java/matrix/SubMatrixInitializer.java
0 → 100644
+
16
−
0
View file @
b85d5d3d
package
matrix
;
public
class
SubMatrixInitializer
<
T
>
implements
MatrixInitializer
<
T
>
{
private
final
Matrix
<
T
>
originalMatrix
;
private
final
Coordinate
corner
;
public
SubMatrixInitializer
(
Matrix
<
T
>
originalMatrix
,
Coordinate
corner
)
{
this
.
originalMatrix
=
originalMatrix
;
this
.
corner
=
corner
;
}
@Override
public
T
initialValueAt
(
Coordinate
coordinate
)
{
return
originalMatrix
.
get
(
coordinate
.
plus
(
corner
));
}
}
This diff is collapsed.
Click to expand it.
src/main/java/model/State.java
+
8
−
3
View file @
b85d5d3d
...
...
@@ -44,7 +44,12 @@ public interface State<S> {
* @return The number of times the specified state appears in the list of neighbors.
*/
static
<
T
>
int
count
(
T
state
,
List
<
T
>
neighbours
)
{
//TODO: à compléter
return
0
;
int
count
=
0
;
for
(
T
neighbour
:
neighbours
)
{
if
(
neighbour
.
equals
(
state
))
{
count
++;
}
}
return
count
;
}
}
\ No newline at end of file
}
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