Skip to content
This repository has been archived by the owner on Jun 18, 2023. It is now read-only.

Commit

Permalink
Merge branch 'documentation' of gitlab.com:aging-team/aging into docu…
Browse files Browse the repository at this point in the history
…mentation
  • Loading branch information
DoomDuck committed May 23, 2020
2 parents b5b59bf + 97134cc commit 9fc6ab4
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 8 deletions.
24 changes: 20 additions & 4 deletions src/model/Universe.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class Universe {
/*!
* \brief Universe dimention getter
*
* \return The bounds of smiluated universe
* \return The bounds of simulated universe
* \warning The bounds is not the smallest Rect that holds the living cells
*/
virtual Rect &bounds() = 0;
Expand All @@ -75,21 +75,37 @@ class Universe {
/* Aptitudes */

/*!
* \brief Cell state setter.
* \brief Cell state setter
*
* \param coord: coord at which to set the cell state
* \param cell_state: cell state that to which to set the destination
*/
virtual void set(const Vec2 &coord, CellState cell_state);
/*!
* \brief Ability to set a cell state
*
* By default returns false. Certain universes can override the function
* to notify their ability to set a cell state.
*
* \return The desired boolean
*/
virtual const bool can_set() const;

/*!
* \brief Cell state getter.
*
* \param coord: Coordonnates to look at.
* \param coord: coordonnates to look at
* \return The state of the cell.
*/
virtual const CellState get(const Vec2 &coord) const;
/*!
* \brief Ability to get a cell state
*
* By default returns false. Certain universes can override the function
* to notify their ability to get a cell state.
*
* \return The desired boolean
*/
virtual const bool can_get() const;

/*
Expand Down Expand Up @@ -118,7 +134,7 @@ class Universe {
* Every new cell is set to the default CellState.
* Cells out of the new bounds are destroyed.
*
* \param bounds: New universe bounds
* \param bounds: new universe bounds
*/
virtual void reshape(const Rect& bounds);
virtual const bool can_reshape() const;
Expand Down
41 changes: 37 additions & 4 deletions src/universes/life/LifeUniverse.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,41 @@
#include "model/Vec2.h"
#include "model/Rect.h"

/*
The classical game of life simulating universe.
With limited size, this CPU based simulation assures
constant performance even on the mose chaotic scenarios.
/*!
* \file LifeUniverse.h
* \brief The universe using the Life algorithm
* \author aging-team
*/

/*!
* \class LifeUniverse
* \brief The universe using the Life algorithm
*
* The classical game of life simulating universe.
* With limited size, this CPU based simulation assures
* constant performance even on the mose chaotic scenarios.
*/
class LifeUniverse: public Universe {
public:
// Constructors

/*!
* \brief Constructor
*
* Base constructor of the universe given a certain size
*
* \param size: the desired size of the universe
*/
explicit LifeUniverse(const Vec2 &size);

/*!
* \brief Constructor
*
* Constructor of the universe given a certain file (.rle)
*
* \param file_path: the path to the file
* \warning As of right not, it throws "Unimplemented". Do not use.
*/
explicit LifeUniverse(QString file_path);
~LifeUniverse();

Expand All @@ -30,9 +55,17 @@ class LifeUniverse: public Universe {
const BigInt &step_size() const override;

// Aptitudes
/*!
* \brief Ability to set a cell state
* \return The boolean true
*/
const bool can_set() const override { return true; }
void set(const Vec2 &target, CellState state) override;

/*!
* \brief Ability to get a cell state
* \return The boolean true
*/
const bool can_get() const override { return true; }
const CellState get(const Vec2 &coord) const override;

Expand Down

0 comments on commit 9fc6ab4

Please sign in to comment.