/ld28

To get this branch, use:
bzr branch http://9ix.org/bzr/ld28
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
util = {
   dim = function(dir)
      if dir == 'x' then
         return 'width'
      elseif dir == 'y' then
         return 'height'
      else
         if STRICT then error('dir '..dir) end
      end
   end,
   dirToXY = function(dir)
                if dir == 'up' or dir == 'down' then
                   return 'y'
                elseif dir == 'left' or dir == 'right' then
                   return 'x'
                else
                   error('bad direction')
                end
             end,
   dirToPosNeg = function(dir)
                    if dir == 'up' or dir == 'left' then
                       return -1
                    elseif dir == 'down' or dir == 'right' then
                       return 1
                    else
                       error('bad direction')
                    end
                 end
}