def render_game(self, game_board):
   packets = self.map_to_packets(game_board)
   for (ip, port) in packets:
     packet = packets[(ip, port)]
     if not ip in self.sockets:
       self.sockets[ip] = util.getConnectedSocket(ip, self.SOCK_PORT)
     final_packet = util.composePixelStripPacket(packet, port) 
     try:
       if self.sockets[ip] != None:
         self.sockets[ip].send(final_packet, 0x00)
     except:
       print 'failure sending packet'
 def render_game(self, game_board):
     packets = self.map_to_packets(game_board)
     for (ip, port) in packets:
         packet = packets[(ip, port)]
         if not ip in self.sockets:
             self.sockets[ip] = util.getConnectedSocket(ip, self.SOCK_PORT)
         final_packet = util.composePixelStripPacket(packet, port)
         try:
             if self.sockets[ip] != None:
                 self.sockets[ip].send(final_packet, 0x00)
         except:
             print 'failure sending packet'
 def old_render_game(self, game_board):
   packets = self.map_to_packets(game_board)
   
   packets_with_destinations = zip(self.POWER_SUPPLY_IPS, packets)
   for (ip, (port, packet)) in packets_with_destinations:
     if not ip in self.sockets:
       self.sockets[ip] = util.getConnectedSocket(ip, self.SOCK_PORT)
     final_packet = util.composePixelStripPacket(packet, port) 
     try:
       if self.sockets[ip] != None:
         self.sockets[ip].send(final_packet, 0x00)
     except:
       print 'failure sending packet'
    def old_render_game(self, game_board):
        packets = self.map_to_packets(game_board)

        packets_with_destinations = zip(self.POWER_SUPPLY_IPS, packets)
        for (ip, (port, packet)) in packets_with_destinations:
            if not ip in self.sockets:
                self.sockets[ip] = util.getConnectedSocket(ip, self.SOCK_PORT)
            final_packet = util.composePixelStripPacket(packet, port)
            try:
                if self.sockets[ip] != None:
                    self.sockets[ip].send(final_packet, 0x00)
            except:
                print 'failure sending packet'