Euphoria
eu::core::generator Namespace Reference

Namespaces

 cell
 

Classes

struct  SmoothRule
 
struct  RandomFillRule
 
struct  FillSmallHolesRule
 
struct  FillAllHoles
 
struct  HorizontalBlankRule
 
struct  Rule
 
struct  Rules
 
struct  CellularAutomata
 
struct  Algorithm
 
struct  RecursiveBacktracker
 
struct  RandomTraversal
 
struct  Drawer
 

Typedefs

using World = BoolTable
 
using ChangeFunction = std::function< std::optional< bool >(bool, const WallCounter &) >
 
using Maze = Table< int >
 

Enumerations

enum class  Direction { north , south , east , west }
 

Functions

void add_random_fill (Rules *cell, Random *random, float random_fill=0.5, Lrud< BorderSetupRule > border_control=Lrud< BorderSetupRule > { BorderSetupRule::always_wall })
 fills the world with random data More...
 
void add_clear_rules (Rules *ca, int times, int count, int range, bool include_self, NeighborhoodAlgorithm algorithm)
 'clears' cells with less than 'count' neighbours, good for removing 'blobs' More...
 
void add_complex_rules (Rules *ca, int times, ChangeFunction change)
 
void add_simple_rules (Rules *ca, int times, int count, bool include_self, NeighborhoodAlgorithm algorithm)
 simple smoothing, less than count neighbours are removed, more -> solid More...
 
void add_horizontal_blank_rule (Rules *ca, int y, int height)
 blanks out cells at 'y' and 'height' down More...
 
void add_spiky_rules (Rules *ca, int times, int count, bool include_self, NeighborhoodAlgorithm algorithm)
 simple smoothing, but always set the cell, seems to provide spikes More...
 
void add_combo_rules (Rules *ca, int times, int count, int big_count, bool include_self, NeighborhoodAlgorithm algorithm)
 smooth but 'big_count' is applied for R(2) More...
 
void add_fill_small_holes_rule (Rules *rules, bool allow_diagonals, int min_count)
 fills all open areas that are less than 'min_count' More...
 
void add_fill_all_holes_rule (Rules *rules, bool allow_diagonals, int holes_to_keep)
 fills all open areas, but keeps 'holes_to_keep' More...
 
vec2i from_dir_to_offset (const Direction d)
 
const std::vector< Direction > & get_all_directions ()
 
Direction flip_direction (const Direction d)
 
cell::Type from_dir_to_cell_path (const Direction d)
 
void set_visited (Maze *maze, const vec2i &np)
 
vec2i add_step_to_maze (Maze *maze, const vec2i &c, Direction dir)
 
bool has_visited (Maze *maze, const vec2i &np)
 
bool can_visit_without_making_loop (Maze *maze, const vec2i &np)
 
template<typename T >
pop_random (std::vector< T > *vec, Random *r)
 
vec2i calc_random_position_on_maze (Random *random, Maze *maze)
 
void add_to_frontier (Maze *maze, std::vector< RandomTraversal::Entry > *frontier, const vec2i &p)
 

Typedef Documentation

◆ ChangeFunction

using eu::core::generator::ChangeFunction = typedef std::function < std::optional<bool> (bool, const WallCounter&) >

Definition at line 57 of file generator_cell.h.

◆ Maze

using eu::core::generator::Maze = typedef Table<int>

Definition at line 38 of file generator_maze.h.

◆ World

Definition at line 15 of file generator_cell.h.

Enumeration Type Documentation

◆ Direction

Enumerator
north 
south 
east 
west 

Definition at line 30 of file generator_maze.h.

Function Documentation

◆ add_clear_rules()

void eu::core::generator::add_clear_rules ( Rules ca,
int  times,
int  count,
int  range,
bool  include_self,
NeighborhoodAlgorithm  algorithm 
)

'clears' cells with less than 'count' neighbours, good for removing 'blobs'

Definition at line 234 of file generator_cell.cc.

◆ add_combo_rules()

void eu::core::generator::add_combo_rules ( Rules ca,
int  times,
int  count,
int  big_count,
bool  include_self,
NeighborhoodAlgorithm  algorithm 
)

smooth but 'big_count' is applied for R(2)

Definition at line 313 of file generator_cell.cc.

◆ add_complex_rules()

void eu::core::generator::add_complex_rules ( Rules ca,
int  times,
ChangeFunction  change 
)

Definition at line 253 of file generator_cell.cc.

◆ add_fill_all_holes_rule()

void eu::core::generator::add_fill_all_holes_rule ( Rules rules,
bool  allow_diagonals,
int  holes_to_keep 
)

fills all open areas, but keeps 'holes_to_keep'

Definition at line 345 of file generator_cell.cc.

◆ add_fill_small_holes_rule()

void eu::core::generator::add_fill_small_holes_rule ( Rules rules,
bool  allow_diagonals,
int  min_count 
)

fills all open areas that are less than 'min_count'

Definition at line 334 of file generator_cell.cc.

◆ add_horizontal_blank_rule()

void eu::core::generator::add_horizontal_blank_rule ( Rules ca,
int  y,
int  height 
)

blanks out cells at 'y' and 'height' down

Definition at line 289 of file generator_cell.cc.

◆ add_random_fill()

void eu::core::generator::add_random_fill ( Rules cell,
Random random,
float  random_fill,
Lrud< BorderSetupRule border_control 
)

fills the world with random data

Definition at line 212 of file generator_cell.cc.

◆ add_simple_rules()

void eu::core::generator::add_simple_rules ( Rules ca,
int  times,
int  count,
bool  include_self,
NeighborhoodAlgorithm  algorithm 
)

simple smoothing, less than count neighbours are removed, more -> solid

Definition at line 269 of file generator_cell.cc.

◆ add_spiky_rules()

void eu::core::generator::add_spiky_rules ( Rules ca,
int  times,
int  count,
bool  include_self,
NeighborhoodAlgorithm  algorithm 
)

simple smoothing, but always set the cell, seems to provide spikes

Definition at line 296 of file generator_cell.cc.

◆ add_step_to_maze()

vec2i eu::core::generator::add_step_to_maze ( Maze maze,
const vec2i c,
Direction  dir 
)

Definition at line 70 of file generator_maze.cc.

◆ add_to_frontier()

void eu::core::generator::add_to_frontier ( Maze maze,
std::vector< RandomTraversal::Entry > *  frontier,
const vec2i p 
)

Definition at line 177 of file generator_maze.cc.

◆ calc_random_position_on_maze()

vec2i eu::core::generator::calc_random_position_on_maze ( Random random,
Maze maze 
)

Definition at line 112 of file generator_maze.cc.

◆ can_visit_without_making_loop()

bool eu::core::generator::can_visit_without_making_loop ( Maze maze,
const vec2i np 
)

Definition at line 88 of file generator_maze.cc.

◆ flip_direction()

Direction eu::core::generator::flip_direction ( const Direction  d)

Definition at line 35 of file generator_maze.cc.

◆ from_dir_to_cell_path()

cell::Type eu::core::generator::from_dir_to_cell_path ( const Direction  d)

Definition at line 49 of file generator_maze.cc.

◆ from_dir_to_offset()

vec2i eu::core::generator::from_dir_to_offset ( const Direction  d)

Definition at line 10 of file generator_maze.cc.

◆ get_all_directions()

const std::vector<Direction>& eu::core::generator::get_all_directions ( )

Definition at line 24 of file generator_maze.cc.

◆ has_visited()

bool eu::core::generator::has_visited ( Maze maze,
const vec2i np 
)

Definition at line 81 of file generator_maze.cc.

◆ pop_random()

template<typename T >
T eu::core::generator::pop_random ( std::vector< T > *  vec,
Random r 
)

Definition at line 101 of file generator_maze.cc.

◆ set_visited()

void eu::core::generator::set_visited ( Maze maze,
const vec2i np 
)

Definition at line 63 of file generator_maze.cc.