Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AzzougLydia AitMouhamedSamy
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
AZZOUG Lydia
AzzougLydia AitMouhamedSamy
Compare revisions
master to ad5e7fc5ad4a00c330bb16b493d6bcbe8413adf5
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
a19028956/tp3
Select target project
No results found
ad5e7fc5ad4a00c330bb16b493d6bcbe8413adf5
Select Git revision
Branches
master
undefined
2 results
Swap
Target
das.s/tp3
Select target project
das.s/tp3
f19002502/tp3
r17010960/tp3
l19004806/tp3
y19010055/tp3
o18034026/tp3
z18029613/tp3
p19021289/tp3
d19027596/tp3
f18010428/tp3
f19003868/tp3
c19022214/tp3
c19017929/tp3
m16014784/tp3
a19028956/tp3
c19026071/tp3
h18008908/tp3
17 results
master
Select Git revision
Branches
master
1 result
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (1)
Replace Cell.java
· ad5e7fc5
AZZOUG Lydia
authored
4 years ago
ad5e7fc5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Cell.java
+30
-30
30 additions, 30 deletions
Cell.java
with
30 additions
and
30 deletions
Cell.java
View file @
ad5e7fc5
/**
* {@link Cell} instances represent the cells of <i>The Game of Life</i>.
*/
public
class
Cell
{
private
boolean
isAlive
;
private
boolean
isRed
;
public
Cell
(){
this
.
isAlive
=
false
;
}
public
void
setisRed
(
boolean
bool
){
this
.
isRed
=
bool
;
}
public
boolean
isRed
(){
return
this
.
isRed
;
}
/**
* Determines whether this {@link Cell} is alive or not.
*
* @return {@code true} if this {@link Cell} is alive and {@code false} otherwise
*/
public
boolean
isAlive
()
{
return
this
.
isAlive
;
}
...
...
@@ -24,7 +30,6 @@ public class Cell {
*
* @return {@code true} if this {@link Cell} is dead and {@code false} otherwise
*/
public
boolean
isDead
()
{
return
!
this
.
isAlive
;
}
...
...
@@ -32,9 +37,7 @@ public class Cell {
/**
* Sets the state of this {@link Cell} to alive.
*
* @param cellState the new state of this {@link Cell}
*/
public
void
setAlive
()
{
this
.
isAlive
=
true
;
}
...
...
@@ -42,18 +45,14 @@ public class Cell {
/**
* Sets the state of this {@link Cell} to dead.
*
* @param cellState the new state of this {@link Cell}
*/
public
void
setDead
()
{
this
.
isAlive
=
false
;
}
/**
* Change the state of this {@link Cell} from ALIVE to DEAD or from DEAD to ALIVE.
*/
public
void
toggleState
()
{
if
(
this
.
isAlive
)
this
.
isAlive
=
false
;
...
...
@@ -63,7 +62,7 @@ public class Cell {
public
boolean
isAliveInNextState
(
int
numberOfAliveNeighbours
)
{
if
(
isAlive
()){
if
(
numberOfAliveNeighbours
==
2
||
numberOfAliveNeighbours
==
3
)
if
(
(
numberOfAliveNeighbours
==
2
)
||
(
numberOfAliveNeighbours
==
3
)
)
return
true
;
else
return
false
;
...
...
@@ -76,3 +75,4 @@ public class Cell {
}
}
}
This diff is collapsed.
Click to expand it.