Skip to content

Instantly share code, notes, and snippets.

View RaytracerRS.reds
Red/System [
Title: "Raytracer"
Notes: "Simple raytracer based on 'Ray Tracing in One Weekend' by Peter Shirley"
Usage: raytracerRS > imagename.ppm
]
#include %../red/runtime/random.reds
_random/init
_random/srand 123
View TangledVariables.reds
Red/System [
]
vector3!: alias struct! [
x [float!]
y [float!]
z [float!]
]
vec3-Mfloat: func [
View FunctionArguments.reds
Red/System [
]
vector3!: alias struct! [
x [float!]
y [float!]
z [float!]
]
vec3-add: func [
View raytracer.red
Red[
Title: "Raytracer"
Needs: 'View
Notes: "Simple raytracer based on 'Ray Tracing in One Weekend' by Peter Shirley"
]
vec3_dot: function [a[vector!] b[vector!]] [
reduce (a/1 * b/1) + (a/2 * b/2) + (a/3 * b/3)
]
View gameoflife2.red
Red [
Title: "Conway's Game of Life"
Needs: 'View
]
system/view/auto-sync?: no
grid: collect [repeat i 50 [keep/only collect [repeat j 50 [keep random true]]]]
scratchgrid: collect [repeat i 50 [keep/only collect [repeat j 50 [keep false]]]]
a: copy grid/1
b: copy grid/50
View gameoflife.red
Red [
Title: "Conway's Game of Life"
Needs: 'View
]
grid: collect [repeat i 10 [keep/only collect [repeat j 10 [keep random true]]]]
scratchgrid: collect [repeat i 10 [keep/only collect [repeat j 10 [keep false]]]]
You can’t perform that action at this time.