Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LO21_Pin_Noir_Boucher_Bouri_Detree
CellulutLO21
Commits
6e2e99f3
Commit
6e2e99f3
authored
May 22, 2021
by
Anthony Noir
Browse files
LifeGameTransition
parent
9666e1b5
Pipeline
#78339
passed with stages
in 16 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
cellulut.pro
View file @
6e2e99f3
...
...
@@ -5,6 +5,3 @@ CONFIG += ordered
SUBDIRS
+=
\
src
\
tests
HEADERS
+=
\
include
/
transitionrule
.
hpp
include/lifegametransition.h
0 → 100644
View file @
6e2e99f3
#ifndef LIFEGAMETRANSITION_H
#define LIFEGAMETRANSITION_H
#include
"transitionrule.hpp"
class
LifeGameTransition
:
TransitionRule
{
public:
LifeGameTransition
();
bool
acceptFormat
(
const
std
::
vector
<
NeighborhoodFormat
>&
)
const
;
unsigned
int
getState
(
unsigned
int
,
const
Neighborhood
&
)
const
;
};
#endif // LIFEGAMETRANSITION_H
src/lifegametransition.cpp
0 → 100644
View file @
6e2e99f3
#include
"lifegametransition.h"
#include
"neighborhoodrule.hpp"
LifeGameTransition
::
LifeGameTransition
()
{
}
bool
LifeGameTransition
::
acceptFormat
(
const
std
::
vector
<
NeighborhoodFormat
>&
formats
)
const
{
for
(
auto
format
=
formats
.
begin
();
format
!=
formats
.
end
();
++
format
)
{
if
(
format
->
positions
.
size
()
!=
8
)
{
return
false
;
}
}
return
true
;
}
unsigned
int
LifeGameTransition
::
getState
(
unsigned
int
,
const
Neighborhood
&
neighborhood
)
const
{
unsigned
int
nb
=
neighborhood
.
getNb
(
1
);
return
(
nb
<=
1
||
nb
>=
4
)
?
0
:
1
;
}
src/src.pro
View file @
6e2e99f3
...
...
@@ -16,6 +16,7 @@ SOURCES += \
arbitraryneighborhoodrule
.
cpp
\
automaton
.
cpp
\
gridview
.
cpp
\
lifegametransition
.
cpp
\
main
.
cpp
\
mooreNeighborhoodRule
.
cpp
\
propertyvisitors
.
cpp
\
...
...
@@ -25,14 +26,17 @@ SOURCES += \
interface
.
cpp
\
grid
.
cpp
\
history
.
cpp
\
lifegametransition
.
h
\
vonNeumannNeighborhoodRule
.
cpp
\
structurewriter
.
cpp
\
structuresavingdialog
.
cpp
\
structurelibraryview
.
cpp
structurelibraryview
.
cpp
\
transitionrule
.
hpp
HEADERS
+=
\
..
/
include
/
automaton
.
hpp
\
..
/
include
/
coord
.
hpp
\
..
/
include
/
lifegametransition
.
h
\
..
/
include
/
neighborhoodrule
.
hpp
\
..
/
include
/
arbitraryneighborhoodrule
.
hpp
\
..
/
include
/
mooreNeighborhoodrule
.
hpp
\
...
...
@@ -52,7 +56,8 @@ HEADERS += \
..
/
include
/
state
.
hpp
\
..
/
include
/
history
.
h
\
..
/
include
/
structuresavingdialog
.
hpp
\
..
/
include
/
structurelibraryview
.
hpp
..
/
include
/
structurelibraryview
.
hpp
\
..
/
include
/
lifegametransition
.
cpp
FORMS
+=
\
..
/
forms
/
interface
.
ui
\
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment