Commit 6e2e99f3 authored by Anthony Noir's avatar Anthony Noir
Browse files

LifeGameTransition

parent 9666e1b5
Pipeline #78339 passed with stages
in 16 seconds
......@@ -5,6 +5,3 @@ CONFIG += ordered
SUBDIRS += \
src \
tests
HEADERS += \
include/transitionrule.hpp
#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
#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;
}
......@@ -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 \
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment