This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Approximates area of Mandelbrot fractal by Monte Carlo sampling. | |
The definition of the Mandelbrot Set is the set of values c \in C where | |
z_{n+1} = z_n^2 + c | |
remains bounded. Most members will be within (-2, 2) x (-2i, 2i) so | |
here this is used as an artificial bounds to simplify the approximation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local WIDTH = 800 | |
local HEIGHT = 600 | |
local shader_code = [[ | |
extern vec2 screen_dims; | |
extern number time; | |
number pi = atan(1.0) * 4.0; | |
vec4 effect(vec4 color, Image image, vec2 uvs, vec2 screen_coords) { | |
vec2 screen_coords_norm = vec2( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ctypes | |
class IntStruct(ctypes.Structure): | |
_fields_ = [("ob_refcnt", ctypes.c_long), | |
("ob_type", ctypes.c_void_p), | |
("ob_size", ctypes.c_ulong), | |
("ob_digit", ctypes.c_long)] | |
def __repr__(self): | |
return ("IntStruct(ob_digit={self.ob_digit}, " | |
"refcount={self.ob_refcnt})").format(self=self) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def S(x): | |
def printx(): | |
print(x) | |
def times_x(multiplier): | |
return multiplier * x | |
def change_x(new_x): | |
nonlocal x | |
x = new_x |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
OlderNewer