]> git.lizzy.rs Git - mt.git/blob - dir.go
693db987b2e1be65e46a2406184309c51076260e
[mt.git] / dir.go
1 package mt
2
3 // A Dir represents a direction parallel to an axis.
4 type Dir uint8
5
6 const (
7         East  Dir = iota // +X
8         Above            // +Y
9         North            // +Z
10         South            // -Z
11         Below            // -Y
12         West             // -X
13         NoDir
14 )
15
16 // Opposite returns the Dir's opposite.
17 // NoDir is its own opposite.
18 func (d Dir) Opposite() Dir {
19         if d >= NoDir {
20                 return NoDir
21         }
22         return 5 - d
23 }