MFMv2.0.10
Movable Feast Machine Simulator 2.0.10
|
#include <Element.h>
Public Member Functions | |
Element (const UUID &uuid) | |
void | AllocateType () |
u32 | GetType () const |
const char * | GetAtomicSymbol () const |
const char * | GetName () const |
virtual void | AppendDescription (const T *atom, OString64 &desc) const |
bool | IsType (u32 type) const |
const UUID & | GetUUID () const |
virtual void | Behavior (EventWindow< CC > &window) const =0 |
virtual const T & | GetDefaultAtom () const |
virtual u32 | PhysicsColor () const |
virtual const char * | GetDescription () const |
virtual u32 | DefaultPhysicsColor () const =0 |
virtual u32 | DefaultLowlightColor () const |
void | ToggleLowlightPhysicsColor () |
virtual u32 | LocalPhysicsColor (const T &atom, u32 selector) const |
virtual u32 | Diffusability (EventWindow< CC > &ew, SPoint nowAt, SPoint maybeAt) const |
u32 | NoDiffusability (EventWindow< CC > &ew, SPoint nowAt, SPoint maybeAt) const |
const ElementParameters< CC > & | GetElementParameters () const |
ElementParameters< CC > & | GetElementParameters () |
const AtomicParameters< CC > & | GetAtomicParameters () const |
AtomicParameters< CC > & | GetAtomicParameters () |
Static Public Attributes | |
static const u32 | COMPLETE_DIFFUSABILITY = 1000 |
Protected Member Functions | |
virtual T | BuildDefaultAtom () const |
const BitVector < P::BITS_PER_ATOM > & | GetBits (const T &atom) const |
BitVector< P::BITS_PER_ATOM > & | GetBits (T &atom) const |
bool | IsValidAtomicSymbol (const char *symbol) |
void | SetAtomicSymbol (const char *symbol) |
void | SetName (const char *name) |
void | Diffuse (EventWindow< CC > &window) const |
virtual u32 | PercentMovable (const T &you, const T &me, const SPoint &offset) const =0 |
|
inline |
|
inline |
|
inlinevirtual |
Appends a short description of the data held by an Atom of this Element.
atom | A pointer to an Atom (guaranteed to be an instance of this Element ) to append a description of. |
desc | The OverflowabeleCharBufferByteSink to append the description to. |
Reimplemented in MFM::Element_Sorter< CC >, and MFM::Element_Data< CC >.
|
pure virtual |
Describes the behavior of this Element. This is invoked when an Atom of this Element is chosen as the center of an EventWindow for an Event, which is given as a parameter.
window | The EventWindow describing the Event which is currently being executed. |
Implemented in MFM::Element_Boids< CC >, MFM::Element_MQBar< CC >, MFM::Element_QBar< CC >, MFM::Element_DBar< CC >, MFM::Element_MQBar< CC >, MFM::Element_SBar< CC >, MFM::Element_Bar< CC >, MFM::Element_Sorter< CC >, MFM::Element_Data< CC >, MFM::AbstractElement_Xtal< CC >, MFM::Element_Shark< CC >, MFM::Element_Consumer< CC >, MFM::Element_Template< CC >, MFM::Element_Fish< CC >, MFM::Element_Dmover< CC >, MFM::Element_Rocket< CC >, MFM::Element_Indexed< CC >, MFM::Element_AntiForkBomb< CC >, MFM::Element_Dreg< CC >, MFM::Element_Emitter< CC >, MFM::Element_Wall< CC >, MFM::Element_Block< CC >, MFM::Element_Res< CC >, MFM::Element_Creg< CC >, MFM::Element_CheckerForkBlue< CC >, MFM::Element_CheckerForkRed< CC >, MFM::Element_Mover< CC >, MFM::Element_ForkBomb3< CC >, MFM::Element_Empty< CC >, MFM::Element_Mover< CC >, MFM::AbstractElement_ForkBomb< CC >, MFM::Element_Collector< CC >, and MFM::AbstractElement_Wanderer< CC >.
|
inlineprotectedvirtual |
Describes how the default Atom of this Element should be constructed. The default behavior of this method builds an atom with the type of this Element and otherwise empty fields.
Reimplemented in MFM::Element_MQBar< CC >, MFM::Element_MQBar< CC >, MFM::Element_Emitter< CC >, and MFM::Element_Consumer< CC >.
|
inlinevirtual |
Gets the 32-bit ARGB formatted color that all Atoms of this Element will be drawn with when they have lowlight drawing enabled.
Reimplemented in MFM::Element_MQBar< CC >, MFM::Element_DBar< CC >, MFM::Element_SBar< CC >, MFM::Element_MQBar< CC >, MFM::Element_Bar< CC >, MFM::Element_Sorter< CC >, MFM::Element_Data< CC >, MFM::Element_Consumer< CC >, MFM::Element_Xtal_General< CC >, MFM::Element_Rocket< CC >, MFM::Element_Template< CC >, MFM::Element_Dmover< CC >, MFM::Element_Dreg< CC >, MFM::Element_Emitter< CC >, MFM::Element_Indexed< CC >, MFM::Element_Creg< CC >, MFM::Element_Res< CC >, MFM::Element_Wanderer_Cyan< CC >, MFM::Element_Wanderer_Magenta< CC >, MFM::Element_Block< CC >, MFM::Element_Empty< CC >, MFM::Element_Wall< CC >, MFM::Element_CheckerForkBlue< CC >, MFM::Element_CheckerForkRed< CC >, MFM::Element_Mover< CC >, MFM::Element_Mover< CC >, and MFM::Element_Collector< CC >.
|
pure virtual |
Gets the 32-bit ARGB formatted color that all Atoms of this Element will be drawn with.
Implemented in MFM::Element_QBar< CC >, MFM::Element_MQBar< CC >, MFM::Element_DBar< CC >, MFM::Element_SBar< CC >, MFM::Element_MQBar< CC >, MFM::Element_AntiForkBomb< CC >, MFM::Element_Bar< CC >, MFM::Element_Sorter< CC >, MFM::Element_Data< CC >, MFM::Element_Shark< CC >, MFM::Element_Consumer< CC >, MFM::Element_Fish< CC >, MFM::Element_Xtal_General< CC >, MFM::Element_Rocket< CC >, MFM::Element_Dreg< CC >, MFM::Element_Emitter< CC >, MFM::Element_Template< CC >, MFM::Element_Dmover< CC >, MFM::Element_Indexed< CC >, MFM::Element_Creg< CC >, MFM::Element_Res< CC >, MFM::Element_Wanderer_Cyan< CC >, MFM::Element_Wanderer_Magenta< CC >, MFM::Element_Block< CC >, MFM::AbstractElement_ForkBomb< CC >, MFM::Element_Empty< CC >, MFM::Element_Wall< CC >, MFM::Element_CheckerForkBlue< CC >, MFM::Element_CheckerForkRed< CC >, MFM::Element_Mover< CC >, MFM::Element_Xtal_L12< CC >, MFM::Element_Mover< CC >, MFM::Element_Xtal_Sq1< CC >, MFM::Element_Collector< CC >, MFM::Element_Boids1< CC >, and MFM::Element_Boids2< CC >.
|
inlinevirtual |
On entry, the Atom at nowAt will be an instance of the type of this Element. How much does that atom like the idea that it should be moved to (or remain at; the two SPoints might be equal) location maybeAt? Return 0 to flat-out veto the idea, or from 0 up to COMPLETE_DIFFUSABILITY to request that fraction of diffusability. (Values larger than COMPLETE_DIFFUSABILITY are treated as equal to it.) Note that nowAt and maybeAt are both relative to the EventWindow ew, but neither is necessarily the center atom!
By default all atoms are considered diffusable, and they return COMPLETE_DIFFUSABILITY chances for every suggested move
Reimplemented in MFM::Element_MQBar< CC >, MFM::Element_QBar< CC >, MFM::Element_DBar< CC >, MFM::Element_MQBar< CC >, MFM::Element_SBar< CC >, MFM::Element_Shark< CC >, MFM::AbstractElement_Xtal< CC >, MFM::AbstractElement_Reprovert< CC >, MFM::Element_Fish< CC >, MFM::Element_Rocket< CC >, MFM::Element_Wall< CC >, and MFM::Element_Block< CC >.
|
protected |
Diffuses the central Atom of a given EventWindow based on the empty places around the Atom and the odds that the central Atom can be diffused.
window | The EventWindow of which the central Atom should attempt to be diffused. |
|
inline |
|
inlineprotected |
|
inlineprotected |
|
inlinevirtual |
Gets the default Atom of this Element . If this Element has not been assigned a type through AllocateType()
, this will FAIL with ILLEGAL_STATE. NOTE: The defaultAtom returned here will have been constructed by Element::BuildDefaultAtom, which leaves all state bits zero. If this is not desirable, element subclasses should override this to provide their own default atom initialization.
Reimplemented in MFM::Element_QBar< CC >, MFM::Element_MQBar< CC >, MFM::Element_DBar< CC >, MFM::Element_SBar< CC >, MFM::Element_MQBar< CC >, MFM::Element_Bar< CC >, MFM::Element_Indexed< CC >, MFM::Element_Sorter< CC >, MFM::Element_Data< CC >, MFM::Element_Shark< CC >, MFM::Element_Fish< CC >, MFM::Element_Rocket< CC >, MFM::Element_Xtal_General< CC >, MFM::Element_Block< CC >, MFM::Element_Wall< CC >, MFM::Element_Mover< CC >, MFM::Element_Mover< CC >, MFM::Element_Collector< CC >, MFM::Element_Boids1< CC >, and MFM::Element_Boids2< CC >.
|
inlinevirtual |
Gets a string of a short description of the behavior of this Element . This will be displayed in some way when a user needs help with this Element . This string must not include newlines; they will be added when they are needed.
Reimplemented in MFM::Element_Data< CC >, MFM::Element_Sorter< CC >, MFM::Element_Consumer< CC >, MFM::Element_Indexed< CC >, MFM::Element_Template< CC >, MFM::Element_Dmover< CC >, MFM::Element_Dreg< CC >, MFM::Element_Emitter< CC >, MFM::Element_Creg< CC >, MFM::Element_Res< CC >, MFM::Element_Wall< CC >, MFM::Element_CheckerForkBlue< CC >, MFM::Element_CheckerForkRed< CC >, and MFM::Element_Empty< CC >.
|
inline |
|
inline |
Gets the unique type of this Element . If the type has not been assigned yet (by using AllocateType()
), this will FAIL with ILLEGAL_STATE .
|
inline |
|
inline |
|
inlineprotected |
Checks to see if a specified Atomic Symbol is a valid symbol. A valid symbol must be either a single capital letter, or a capital letter followed by a single lowercase letter.
symbol | The string to check symbolic validity of. |
true
If symbol
is a valid atomic symbol, else false
.
|
inlinevirtual |
Used during rendering, will select a color for any Atom of this Element to be rendered with. This should be overridden if wanting to use a gradient or some other variable color based on the body of the specified Atom .
atom | The Atom of this element of which to find a color for. |
selector | An additional argument which may be used to determine the color of which to render atom |
atom
with. Reimplemented in MFM::Element_MQBar< CC >, MFM::Element_QBar< CC >, MFM::Element_DBar< CC >, MFM::Element_SBar< CC >, MFM::Element_MQBar< CC >, MFM::Element_Bar< CC >, MFM::Element_Sorter< CC >, MFM::Element_Data< CC >, MFM::Element_Xtal_General< CC >, MFM::Element_AntiForkBomb< CC >, MFM::Element_Indexed< CC >, MFM::Element_ForkBomb3< CC >, MFM::Element_ForkBomb1< CC >, MFM::Element_ForkBomb2< CC >, MFM::Element_Xtal_L12< CC >, MFM::Element_Xtal_Sq1< CC >, and MFM::AbstractElement_ForkBomb< CC >.
|
inline |
A utility method available to subclasses that specifies no diffusion is allowed, by specifying a 0 value for the Diffusability of every position except when nowAt == maybeAt.
|
protectedpure virtual |
Determines how likely an Atom of this type is to be swapped with during diffusal.
Implemented in MFM::Element_MQBar< CC >, MFM::Element_QBar< CC >, MFM::Element_DBar< CC >, MFM::Element_SBar< CC >, MFM::Element_MQBar< CC >, MFM::Element_AntiForkBomb< CC >, MFM::Element_Shark< CC >, MFM::Element_Data< CC >, MFM::Element_Sorter< CC >, MFM::AbstractElement_Xtal< CC >, MFM::Element_Fish< CC >, MFM::Element_Rocket< CC >, MFM::Element_Consumer< CC >, MFM::Element_Wall< CC >, MFM::AbstractElement_WaPat< CC >, MFM::Element_Block< CC >, MFM::Element_Emitter< CC >, MFM::Element_Dreg< CC >, MFM::Element_Mover< CC >, MFM::Element_Template< CC >, MFM::Element_Dmover< CC >, MFM::Element_Mover< CC >, MFM::Element_Indexed< CC >, MFM::Element_Collector< CC >, MFM::Element_Creg< CC >, MFM::Element_Res< CC >, MFM::Element_Wanderer_Cyan< CC >, MFM::Element_Wanderer_Magenta< CC >, MFM::AbstractElement_ForkBomb< CC >, MFM::Element_CheckerForkBlue< CC >, MFM::Element_CheckerForkRed< CC >, MFM::Element_Empty< CC >, and MFM::AbstractElement_Wanderer< CC >.
|
inlinevirtual |
|
inlineprotected |
Sets the Atomic Symbol of this Element, which is mainly used during the rendering of this Element .
symbol | The string representing the Atomic Symbol of this Element. If this symbol is not valid (in terms of the IsValidAtomicSymbol() method), this will FAIL with ILLEGAL_ARGUMENT . |
|
inlineprotected |
|
inline |
Toggles the lowlight / normal rendering of all Atoms of this Element.
|
static |
A standard basis for specifying degrees of diffusability.