-
Notifications
You must be signed in to change notification settings - Fork 0
/
lrscan.go
51 lines (44 loc) · 1.03 KB
/
lrscan.go
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
50
51
package main
import "fmt"
func lrscan(v int) {
var q *quadrant
if check_out(LRSCAN) {
return
}
fmt.Printf("Long range scan for quadrant %d,%d\n\n", ship.quadx, ship.quady)
/* print the header on top */
for j := ship.quady - 1; j <= ship.quady+1; j++ {
if j < 0 || j >= NQUADS {
fmt.Printf(" ")
} else {
fmt.Printf(" %1d", j)
}
}
/* scan the quadrants */
for i := ship.quadx - 1; i <= ship.quadx+1; i++ {
fmt.Printf("\n -------------------\n")
if i < 0 || i >= NQUADS {
fmt.Printf(" ! * ! * ! * !")
continue
}
/* print the left hand margin */
fmt.Printf("%1d !", i)
for j := ship.quady - 1; j <= ship.quady+1; j++ {
if j < 0 || j >= NQUADS {
/* negative energy barrier again */
fmt.Printf(" * !")
continue
}
q = &quad[i][j]
if q.stars < 0 {
/* supernova */
fmt.Printf(" /// !")
q.scanned = 1000
continue
}
q.scanned = q.klings*100 + q.bases*10 + q.stars
fmt.Printf(" %3d !", q.scanned)
}
}
fmt.Printf("\n -------------------\n")
}