File: jonhex.wl

package info (click to toggle)
wadc 2.1%2Bgit3aac3015-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,312 kB
  • ctags: 643
  • sloc: java: 2,771; ansic: 1,526; xml: 125; makefile: 33; sh: 13
file content (44 lines) | stat: -rw-r--r-- 577 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#"standard.h"


hex(s) {

  step(64,0)
  step(32,-56)
  step(-32,-56)
  step(-64,0)
  step(-32,56)
  step(32,56)
  s
}
noop { move(0) }

flip(x) { eq(x,-1) ? 1 : -1 }

jitter { 0 | 8 | -8 | 16 | -16 }

hexes(w, h) {
 
  set("hexes", 1)

  for(1, h,

    !hexes
    for(1, w,
      print("hi")
      hex( leftsector(jitter, add(128, jitter), 128))
      movestep(0,112) -- horizontal spacing
    )
    ^hexes
    movestep(96,mul(get("hexes"), 56)) -- vertical spacing
    set("hexes", mul(-1, get("hexes")))
  )

}

main {
  pushpop( movestep(32,32) thing )
  
  hexes(16,8)

}