Skip to content
This repository was archived by the owner on Dec 2, 2025. It is now read-only.
iluha168 edited this page Jan 27, 2023 · 7 revisions

Welcome to the h wiki! h programming language is just a proof of concept.

It is an interpreted, case-sensitive, turing-complete language based on X11 graphics. h's features can be found on the sidebar.

For example, here is a script that draws the mandelbrot set in a window:

size = 300j+300k
center = size*-0.5j
w = new Window(100+100i+size, "Mandelbrot!")

MAX_ITER = 20
RE_BEGIN = -1.8
RE_END = 0.6
IM_BEGIN = -1.1
IM_END = 1.1


for (pos=0) (pos[1] < size[3]) (pos=pos+1i) {
    for (pos = pos[1]*1i) (pos[0] < size[2]) (pos=pos+1) {
        c = (RE_BEGIN + (RE_END-RE_BEGIN) * pos[0]*size[2].reciprocal()) +
            (IM_BEGIN + (IM_END-IM_BEGIN) * pos[1]*size[3].reciprocal()) * 1i
        z = c
        i = 0
        while i < MAX_ITER {
            z = z.sq() + c
            i = i + 1
            if (z.absSq() > 3) break
        }
        c = 255 * (1 - (MAX_ITER.reciprocal()*i))

        w.foreground(c+(c*1i)+(c*1j))
        w.drawPoint(pos)
    }
}

image

Sierpiński triangle:

size = 400

w = new Window(100+100i+(size*(1j+1k)), "Triangle!")
v = [size*0.5, size*1i, size*(1+1i)]
uvfactor = (size*3.46410161513775).reciprocal()*2*255
p = v[0]

while true {
    w.foreground(((v[0]-p).abs() + ((v[1]-p).abs()*1i) + ((v[2]-p).abs()*1j))*uvfactor)
    w.drawPoint(p)
    p = p + ((v[p.random()*3] - p)*0.5)
}

image

Clone this wiki locally