text: // Generated by CoffeeScript 1.6.3
  (function() {
    deucesApp.controller('RoomController', [
      '$scope', 'socket', function($scope, socket) {
        $scope.inRoom = false;
        $scope.requestRoom = function() {
          return socket.emit('room', $scope.roomName);
        };
        $scope.startTestGame = function() {
          return socket.emit('startTestGame');
        };
        socket.on("joined:game", function(data) {
          $scope.roomName = data.room;
          return $scope.inRoom = true;
        });
        return socket.on("nameResult", function(data) {
          if (data.success) {
            return $scope.playerName = data.name;
          }
        });
      }
    ]);
  
    deucesApp.controller('GameController', [
      '$scope', 'socket', 'playerMap', function($scope, socket) {
        socket.on("players:updated", function(data) {
          return $scope.players = data.players;
        });
        $scope.startGame = function() {
          return socket.emit('startGame');
        };
        socket.on("joined:game", function(data) {
          return $scope.playerIndex = data.playerIndex;
        });
        socket.on("update:turn", function(data) {
          return $scope.whoseTurn = data;
        });
        socket.on("hand", function(data) {
          return $scope.hand = data;
        });
        $scope.suitSpecialCharacter = function(suit) {
          if (suit === "Diamond") {
            return "&diams;";
          } else {
            return "&" + suit.toLowerCase() + "s;";
          }
        };
        $scope.playCards = function() {
          return socket.emit('play:cards', $scope.selectedCards());
        };
        $scope.selectedCards = function() {
          return _.filter($scope.hand, function(card) {
            return card.selected;
          });
        };
        $scope.pass = function() {
          return socket.emit('pass');
        };
        socket.on("update:game", function(data) {
          $scope.players = data.players;
          $scope.center = data.center;
          return $scope.whoseTurn = data.whoseTurn;
        });
        return socket.on("gameOver", function(data) {
          $scope.players = data.players;
          $scope.gameOver = true;
          return $scope.winnerIndex = data.whoseTurn;
        });
      }
    ]);
  
  }).call(this);
  