rotate board on output

This commit is contained in:
stryan 2022-03-16 23:26:13 -04:00
parent 209a4f5caf
commit 7558da5c8e

10
api.go
View File

@ -81,7 +81,15 @@ func (a *API) GetGame(res http.ResponseWriter, req *http.Request) {
} }
log.Println("sending game state") log.Println("sending game state")
respondWithJSON(res, http.StatusOK, gameResp{s.getBoard(p)}) rotatedBoard := s.getBoard(p)
i := 0
temp := rotatedBoard[0]
for ; i < len(rotatedBoard)-1; i++ {
rotatedBoard[i] = rotatedBoard[i+1]
}
rotatedBoard[i] = temp
respondWithJSON(res, http.StatusOK, rotatedBoard)
return return
} }