Skip to content
Snippets Groups Projects
Commit c8454a93 authored by Alex Constantin-Gomez's avatar Alex Constantin-Gomez
Browse files

int to str on plyr

parent dc742423
No related branches found
No related tags found
No related merge requests found
...@@ -30,7 +30,7 @@ type Game struct { ...@@ -30,7 +30,7 @@ type Game struct {
// Move represents a move in the game // Move represents a move in the game
type Move struct { type Move struct {
GameID string `json:"game_id"` GameID string `json:"game_id"`
Player int `json:"player"` Player string `json:"player"`
MoveData string `json:"move"` MoveData string `json:"move"`
GameOver string `json:"game_over"` GameOver string `json:"game_over"`
} }
...@@ -88,8 +88,9 @@ func move(w http.ResponseWriter, r *http.Request) { ...@@ -88,8 +88,9 @@ func move(w http.ResponseWriter, r *http.Request) {
gameDataMutex.RLock() gameDataMutex.RLock()
game := gameData[move.GameID] game := gameData[move.GameID]
gameDataMutex.RUnlock() gameDataMutex.RUnlock()
sendChan := game.Channels[move.Player] p, _ := strconv.Atoi(move.Player)
recChan := game.Channels[1-move.Player] sendChan := game.Channels[p]
recChan := game.Channels[1-p]
sendChan <- move.MoveData sendChan <- move.MoveData
// If game over or disconnect occurs // If game over or disconnect occurs
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment