Skip to content

Commit

Permalink
Cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
chandler767 committed Aug 16, 2018
1 parent 6bf8844 commit 717a559
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 3 additions & 4 deletions game.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ func countdown(hostName string, guestName string) {

func startGame(isHost bool, lobby string, hostName string, guestName string, pn *pubnub.PubNub) {
var (
err error
spaced bool
progress int
winner string
Expand Down Expand Up @@ -61,10 +60,10 @@ func startGame(isHost bool, lobby string, hostName string, guestName string, pn
select {
case message := <-gamelistener.Message:
if msg, ok := message.Message.(map[string]interface{}); ok {
if val, ok := msg["guestProgress"]; ok { // The host receives the guest username then the host sends the host username and starts a game.
if val, ok := msg["guestProgress"]; ok {
guestBar.Set(int(val.(float64)))
}
if val, ok := msg["hostProgress"]; ok { // When the guest receives the host username then the game is ready to start.
if val, ok := msg["hostProgress"]; ok {
hostBar.Set(int(val.(float64)))
}
}
Expand All @@ -76,7 +75,7 @@ func startGame(isHost bool, lobby string, hostName string, guestName string, pn
Channels([]string{lobby}).
Execute()

err = term.Init()
err := term.Init()
if err != nil {
panic(err)
}
Expand Down
2 changes: 0 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ package main
import (
"fmt"
pubnub "github.com/pubnub/go"
"runtime"
)

func main() {
runtime.GOMAXPROCS(runtime.NumCPU()) // Use all available cpu cores.
config := pubnub.NewConfig()
config.SubscribeKey = "sub-key"
config.PublishKey = "pub-key"
Expand Down

0 comments on commit 717a559

Please sign in to comment.