   # Create a game if there are two users free
   users.forEach (u) ->
     if u != me and !u.opponent
+
       u.opponent = me
       me.opponent = u
+      u.set('playing', me.get('nick'))
+      me.set('playing', u.get('nick'))
 
       me.socket.emit('StartGame', {opponent: u})
       u.socket.emit('StartGame', {opponent: me})

class User extends Backbone.Model


class UserCollection extends Backbone.Collection
  model: User

users = new UserCollection()




    socket.emit('LobbyList', users.toJSON())

  socket.on 'StateUpdate', (data) ->
    me.state = data
    if me.opponent
      me.opponent.socket.emit 'StateUpdate', me.state


  socket.on 'disconnect', ->
    if me.opponent
      u = me.opponent
      u.set('playing', false)
      u.opponent = undefined
      me.opponent.socket.emit 'YourOpponentLeftSorryBro', {really: 'sorry'}

    users.remove(me)
    socket.broadcast.emit 'LobbyList', users.toJSON()
