File: blockmap.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 (49 lines) | stat: -rw-r--r-- 620 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
45
46
47
48
49
#"lisp.wl"



blockmap_init {
    set("blockmap", nil)
}

tuple_eq(ta, tb) {
  eq( hd(ta), hd(tb) )
      ? eq( tl(ta), tl(tb) )
      : 0
}

-- is elem in the supplied list?
tuple_in_list(elem, list) {
   eq(nil, list
       ? 0
       : tuple_eq(elem, hd(list))
         ? 1
         : in_list(elem, tl(list))
         )
     )
}

blockmap_mark(x,y) {
  if(in_list(
}

room(x,y) {

   eq(nil, get("blockmap"))
       ? y
       : cons(hd(x), append(tl(x), y))

    box(0,128,128, 128, 128)
}

main {

  blockmap_init

  -- first room: should work
  room(0,0)

  -- second room, same coords: should fail
  room(0,0)

}