Skip to content

Instantly share code, notes, and snippets.

@lonjil
Forked from anonymous/draft.txt
Last active December 24, 2015 04:59
Show Gist options
  • Save lonjil/6747448 to your computer and use it in GitHub Desktop.
Save lonjil/6747448 to your computer and use it in GitHub Desktop.
magic

Mana = hp = energy spells ~ forth (a stack-based programming language)

force ( f -- ) applies a force of [f] on a radius of 1 micro-meter around the casting point for 1 micro-second in the z+ direction

caster is coord = {0, 0, 0} x=+left-right,y=+up-down,z=+forward-backward the numbers are in micro- SI units direction = degrees, deg=0=z+

light ( photons wl -- ) creates [photons] number of photons at cast point with wavelength [wl], going in the z+ direction

cast/ ( dist -- caster ) creates new caster at [dist] micro-meters in direction z+ all input between cast/ and / is put om new casters stack casters act like seperate threads

spin ( xz-axis yz-axis -- ) normalizes z+ to direction pointed towards by [xz-axis] and [yz-axis]

dc/ ( caster -- ) like cast/ , minus the creating part

stop ( -- ) stops execution on current caster

kill ( cast-id -- ) kills caster with id [cast-id]

sleep ( t -- ) blocks execution for [t] micro-seconds

heat ( energy -- ) heats up a sphere with a radius of 1 micro-meter around the caster

: c.rot90up ( -- ) 0 90 c.a-move ; : c.rot90left ( -- ) 90 0 c.a-move ; : heat-line ( energy length -- ) 0 do dup i i cast/ >c heat stop / loop drop ; : heat-square ( energy size -- ) dup 0 do 2dup i i cast/ c.rot90up >c >c heat-line stop / loop 2drop ; : heat-cube ( energy size -- ) dup 0 do 2dup i i cast/ c.rot90left >c >c heat-square stop / loop 2drop ;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment