Fixes #4, additional debug
This commit is contained in:
parent
9aad81f7cd
commit
2e13d93a53
32
game.go
32
game.go
@ -87,7 +87,7 @@ func (game *Game) gameDirector() {
|
||||
game.drawScore()
|
||||
game.drawPlayer()
|
||||
//game.drawCoords()
|
||||
//game.drawDebug()
|
||||
game.drawDebug()
|
||||
|
||||
// Draw robots??
|
||||
if len(game.robots) == 0 {
|
||||
@ -169,21 +169,27 @@ func quit(game *Game) {
|
||||
}
|
||||
|
||||
func (game *Game) randPos() Position {
|
||||
var safe bool = false
|
||||
//var safe bool = false
|
||||
var pos Position
|
||||
|
||||
for !safe {
|
||||
x := rand.Intn(80)
|
||||
y := rand.Intn(24)
|
||||
// for !safe {
|
||||
// x := rand.Intn(80)
|
||||
// y := rand.Intn(24)
|
||||
|
||||
if x == 0 || x == 79 || y == 0 || y == 23 {
|
||||
safe = false
|
||||
} else {
|
||||
pos.x = x
|
||||
pos.y = y
|
||||
safe = true
|
||||
}
|
||||
}
|
||||
// if x == 0 || x == 79 || y == 0 || y == 23 {
|
||||
// safe = false
|
||||
// } else {
|
||||
// pos.x = x
|
||||
// pos.y = y
|
||||
// safe = true
|
||||
// }
|
||||
// }
|
||||
|
||||
x := 1 + rand.Intn(77)
|
||||
y := 1 + rand.Intn(22)
|
||||
|
||||
pos.x = x
|
||||
pos.y = y
|
||||
|
||||
return pos
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ func (game *Game) drawCoords() {
|
||||
|
||||
func (game *Game) drawDebug() {
|
||||
var x, y int = 40, 24
|
||||
for _, r := range []rune("[ NumGoRoutine: " + strconv.FormatInt(int64(runtime.NumGoroutine()), 10) + " ]") {
|
||||
for _, r := range []rune("[ NumGoRoutine: " + strconv.FormatInt(int64(runtime.NumGoroutine()), 10) + " Bots: " + strconv.FormatInt(int64(len(game.robots)), 10) + " ]") {
|
||||
game.screen.SetContent(x, y-1, r, nil, game.style)
|
||||
x++
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user