M
Size: a a a
M
CD
M
CD
M
M
CD
M
M
CD
M
//
// Created by ivantretyak on 09.03.2021.
//
#ifndef TEST_GENETICS_CELL_H
#define TEST_GENETICS_CELL_H
#include "Coordinate.h"
#include <random>
enum CellType {
herbivor,
predator,
};
enum Moving {
up,
right,
left,
down,
};
class Cell {
private:
CellType type;
int energy;
int EnergyForReproduction;
Moving primaryDirection;
Coordinate coordinate = Coordinate(0, 0);
public:
Cell(Coordinate coordinate);
};
#endif //TEST_GENETICS_CELL_H
M
CD
M
//
// Created by ivantretyak on 09.03.2021.
//
#include "Cell.h"
Cell::Cell(Coordinate coordinate) {
std::random_device rd;
std::mt19937_64 gen(rd());
std::uniform_int_distribution<> types(0, 2);
std::uniform_int_distribution<> moving(0, 3);
Cell::coordinate = coordinate;
Cell::type = static_cast<CellType>(types(gen));
Cell::primaryDirection = static_cast<Moving>(moving(gen));
}
M
M
M
CD
CD