go fmt
This commit is contained in:
parent
f9b646e50c
commit
bf853880ca
1
game.go
1
game.go
@ -88,7 +88,6 @@ func (g *game) run() {
|
||||
robots_remaining++
|
||||
p.scan(g.players)
|
||||
p.nudge()
|
||||
// XXX: change to pointer, check for pointer as (0, 0) is valid target
|
||||
if p.Robot.FireAt != nil {
|
||||
proj := p.fire(g.projectiles)
|
||||
if proj != nil {
|
||||
|
24
http.go
24
http.go
@ -33,21 +33,21 @@ func startGame(w http.ResponseWriter, req *http.Request) {
|
||||
func listGames(w http.ResponseWriter, req *http.Request) {
|
||||
games.RLock()
|
||||
defer games.RUnlock()
|
||||
type gl struct {
|
||||
Id string `json:"id"`
|
||||
Players []string `json:"players"`
|
||||
}
|
||||
type gl struct {
|
||||
Id string `json:"id"`
|
||||
Players []string `json:"players"`
|
||||
}
|
||||
ids := make([]gl, 0)
|
||||
for id, g := range games.m {
|
||||
players := make([]string, 0)
|
||||
for p, _ := range g.players {
|
||||
// XXX: change this to be the user-provided bot name?
|
||||
players = append(players, p.Robot.Id)
|
||||
}
|
||||
players := make([]string, 0)
|
||||
for p, _ := range g.players {
|
||||
// XXX: change this to be the user-provided bot name?
|
||||
players = append(players, p.Robot.Id)
|
||||
}
|
||||
ids = append(ids, gl{
|
||||
Id: id,
|
||||
Players: players,
|
||||
})
|
||||
Id: id,
|
||||
Players: players,
|
||||
})
|
||||
}
|
||||
if err := json.NewEncoder(w).Encode(ids); err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
|
Loading…
Reference in New Issue
Block a user