sesopenko_diamond_square v1.0.0 Sesopenko.DiamondSquare

Generates a fractal map grid using the Diamond Square Algorithm.

# Initialize an instance
my_diamond_square = Sesopenko.DiamondSquare.init(n)
# advance:
{:ok, new_state} = Sesopenko.DiamondSquare.perform_step(my_diamond_square)

Link to this section Summary

Functions

Initializes a DiamondSquare with starting values for a given n.

Advances a given diamond square, adding points if it's not already done.

Link to this section Functions

Initializes a DiamondSquare with starting values for a given n.

Helper method for getting a fresh diamond square. The corners will be initialized with random values.

Returns `{:ok, %Sesopenko.DiamondSquare}

Link to this function

perform_step(diamond_square)

Advances a given diamond square, adding points if it's not already done.

returns {:ok, %DiamondSquare{}}

Link to this function

step_to_end(diamond_square)

Link to this function

step_to_end(diamond_square, atom)