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 {
// Move represents a move in the game
type Move struct {
GameID string `json:"game_id"`
Player int `json:"player"`
Player string `json:"player"`
MoveData string `json:"move"`
GameOver string `json:"game_over"`
}
......@@ -88,8 +88,9 @@ func move(w http.ResponseWriter, r *http.Request) {
gameDataMutex.RLock()
game := gameData[move.GameID]
gameDataMutex.RUnlock()
sendChan := game.Channels[move.Player]
recChan := game.Channels[1-move.Player]
p, _ := strconv.Atoi(move.Player)
sendChan := game.Channels[p]
recChan := game.Channels[1-p]
sendChan <- move.MoveData
// 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