aboutsummaryrefslogtreecommitdiff
path: root/src/game/cell_helper.hpp
blob: 0439269dc902929fc7c4e800468b69fa12981052 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#pragma once

#include <memory>
#include <vector>

#include "engine/data/vector2.hpp"
#include "interfaces/cell_helper.hpp"
#include "interfaces/matrix.hpp"

template <typename MatrixElement>
class CellHelper : public ICellHelper
{
public:
	explicit CellHelper(std::shared_ptr<IMatrix<MatrixElement>> matrix) noexcept;

	[[nodiscard]] auto compute_is_cell_dying(const Vector2 &cell_pos) const noexcept
		-> bool override;

	[[nodiscard]] auto compute_birth_cell_positions(
		const std::vector<Vector2> &cell_positions) const noexcept
		-> std::vector<Vector2> override;

private:
	const std::shared_ptr<IMatrix<MatrixElement>> _matrix;

	[[nodiscard]] auto _get_valid_pos_neighbours(const Vector2 &position) const noexcept
		-> std::vector<Vector2>;
};

#include "cell_helper_impl.hpp"