Skip to content

Instantly share code, notes, and snippets.

@kevinsingh5
Created November 29, 2017 03:44
Show Gist options
  • Save kevinsingh5/bcae83677626bd498d69e4b4debc2806 to your computer and use it in GitHub Desktop.
Save kevinsingh5/bcae83677626bd498d69e4b4debc2806 to your computer and use it in GitHub Desktop.
Life design
template <typename T>
class Life {
vector<vector<T>> grid;
void read() {
}
void eval() {
}
void print() {
}
}
/***************/
class Cell {
Abstract Cell *p
// contructor takes in pointer to const cell
public Cell(const Cell&){
}
// constructor takes in ref ref cell
public Cell(Cell&&) {
}
Cell& operator = (const Cell& rhs){
}
Cell& operator = (Cell&&) {
}
// destructor
~Shape() {
delete p;
}
void evolve() {
}
}
/***************/
class AbstractCell {
bool state;
virtual ~AbstractCell() {
}
virtual AbstractCell* clone() const = 0 {
}
virtual evolve () = 0 {
}
}
/****************/
class ConwayCell {
ConwayCell* clone() const {
}
evolve () {
}
}
/****************/
class FredkinCell {
int age;
FredkinCell* clone() const{
}
evolve() {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment