Receives joystick values from the SnakeBoard
            
            x,y      Coordinates
            n        Robot number to give it to
195877
def set_joystick(self, x, y, n):
        
        self.robots[n].set_joystick(x, y)
377984
def on_to_coordinates(self, speed, x_target_mm, y_target_mm, brake=True, block=True):
        
        assert self.odometry_thread_id, "odometry_start() must be called to track robot coordinates"

        # stop moving
        self.off(brake='hold')

        # rotate in place so we are pointed straight at our target
        x_delta = x_target_mm - self.x_pos_mm
        y_delta = y_target_mm - self.y_pos_mm
        angle_target_radians = math.atan2(y_delta, x_delta)
        angle_target_degrees = math.degrees(angle_target_radians)
        self.turn_to_angle(speed, angle_target_degrees, brake=True, block=True)

        # drive in a straight line to the target coordinates
        distance_mm = math.sqrt(pow(self.x_pos_mm - x_target_mm, 2) + pow(self.y_pos_mm - y_target_mm, 2))
        self.on_for_distance(speed, distance_mm, brake, block)
679382
def click_at_coordinates(self, x, y):
        
        self.device.click(int(x), int(y))
1122174
def click(self, x, y, button=1, n=1):
        

        for i in range(n):
            self.press(x, y, button)
            self.release(x, y, button)
370219
public double getInputValue(Axis input, double x, double y)
    {
        final double v;
        switch (input)
        {
            case X:
                v = Math.floor(x - tile.getX());
                break;
            case Y:
                v = Math.floor(y - tile.getY());
                break;
            default:
                throw new LionEngineException(input);
        }
        return v;
    }
516669
def get_keys_to_action(self):
        """"""
        # keyboard keys in an array ordered by their byte order in the bitmap
        # i.e. right = 7, left = 6, ..., B = 1, A = 0
        buttons = np.array([
            ord('d'),  # right
            ord('a'),  # left
            ord('s'),  # down
            ord('w'),  # up
            ord('\r'), # start
            ord(' '),  # select
            ord('p'),  # B
            ord('o'),  # A
        ])
        # the dictionary of key presses to controller codes
        keys_to_action = {}
        # the combination map of values for the controller
        values = 8 * [[0, 1]]
        # iterate over all the combinations
        for combination in itertools.product(*values):
            # unpack the tuple of bits into an integer
            byte = int(''.join(map(str, combination)), 2)
            # unwrap the pressed buttons based on the bitmap
            pressed = buttons[list(map(bool, combination))]
            # assign the pressed buttons to the output byte
            keys_to_action[tuple(sorted(pressed))] = byte

        return keys_to_action
327821
def convert_output_to_v4(self, controller_input):
        """"""
        player_input = SimpleControllerState()
        player_input.throttle = controller_input[0]
        player_input.steer = controller_input[1]
        player_input.pitch = controller_input[2]
        player_input.yaw = controller_input[3]
        player_input.roll = controller_input[4]
        player_input.jump = controller_input[5]
        player_input.boost = controller_input[6]
        player_input.handbrake = controller_input[7]

        return player_input
852541
def rect_helper(x0, y0, x1, y1):
        """"""
        x0, y0, x1, y1 = force_int(x0, y0, x1, y1)
        if x0 > x1:
            x0, x1 = x1, x0
        if y0 > y1:
            y0, y1 = y1, y0
        return x0, y0, x1, y1
812902
def compute_coordinates(self):
        
        self._x, self._y = self.board.index_to_coordinates(self.index)
1373349
function WidgetNumber() {
        this.addOutput("", "number");
        this.size = [80, 60];
        this.properties = { min: -1000, max: 1000, value: 1, step: 1 };
        this.old_y = -1;
        this._remainder = 0;
        this._precision = 0;
        this.mouse_captured = false;
    }
361016
private int getSeqPos(MouseEvent e) {

		int x = e.getX();
		//int y = e.getY();
		//float scale = seqScale.getScale();
		//int DEFAULT_X_START = SequenceScalePanel.DEFAULT_X_START;

		float scale = parent.getScale();

		coordManager.setScale(scale);
		int seqpos = coordManager.getSeqPos(x-2);


		return seqpos  ;
	}
1064548
function( options ) {
			var joystick = new TouchableJoystick(options);
			joystick.id = this.touchableAreas.push( joystick);
			this.touchableAreasCount++;
			this.boundingSet(options);
		}
540968
def get_bot_mapping(self):
        """"""
        bot = self.context.bot
        mapping = {
            cog: cog.get_commands()
            for cog in bot.cogs.values()
        }
        mapping[None] = [c for c in bot.all_commands.values() if c.cog is None]
        return mapping
952504
def controlPoints(cmd, data):
    
    cmd = cmd.lower()
    if cmd in ['c', 's', 'q']:
        indices = range(len(data))
        if cmd == 'c':  # c: (x1 y1 x2 y2 x y)+
            return [index for index in indices if (index % 6) < 4]
        elif cmd in ['s', 'q']:  # s: (x2 y2 x y)+   q: (x1 y1 x y)+
            return [index for index in indices if (index % 4) < 2]

    return []
269766
def update(self):
        
        with self.syncing:
            for m in self._motors:
                to_set = defaultdict(list)

                for p in self._prim:
                    for key, val in getattr(p.robot, m.name)._to_set.iteritems():
                        to_set[key].append(val)

                for key, val in to_set.iteritems():
                    if key == 'led':
                        colors = set(val)
                        if len(colors) > 1:
                            colors -= {'off'}
                        filtred_val = colors.pop()
                    else:
                        filtred_val = self._filter(val)

                    logger.debug('Combined %s.%s from %s to %s',
                                 m.name, key, val, filtred_val)
                    setattr(m, key, filtred_val)

            [p._synced.set() for p in self._prim]
1346842
function () {
    var controllers = this.controllers;
    var gamepad;
    var gamepads;
    var i;
    var prevCount;

    gamepads = navigator.getGamepads && navigator.getGamepads();
    if (!gamepads) { return; }

    prevCount = controllers.length;
    controllers.length = 0;
    for (i = 0; i < gamepads.length; ++i) {
      gamepad = gamepads[i];
      if (gamepad && gamepad.pose) {
        controllers.push(gamepad);
      }
    }

    if (controllers.length !== prevCount) {
      this.el.emit('controllersupdated', undefined, false);
    }
  }
202134
def start_sim(self, gui=True, set_values={}, error=None):
        
        self.error = error
        if not self.is_running.is_set():
            def loop():
                self.need_to_stop.clear()
                self.is_running.set()
                for robot in self.robots:
                    if robot.brain:
                        self.runBrain(robot.brain)
                count = 0
                while not self.need_to_stop.isSet():
                    if not self.paused.is_set():
                        self.clock += self.sim_time
                        for robot in self.robots:
                            try:
                                robot.update()
                            except Exception as exc:
                                self.need_to_stop.set()
                                if error:
                                    error.value = "Error: %s. Now stopping simulation." % str(exc)
                                else:
                                    raise
                    if gui:
                        self.draw()
                    if count % self.gui_update == 0:
                        if "canvas" in set_values:
                            set_values["canvas"].value = str(self.render())
                        if "energy" in set_values:
                            if len(self.robots) > 0:
                                set_values["energy"].value = str(self.robots[0].energy)
                    count += 1
                    self.realsleep(self.sim_time)
                    if self.robots[0].energy <= 0:
                        self.need_to_stop.set()
                self.is_running.clear()
                for robot in self.robots:
                    robot.stop()
            threading.Thread(target=loop).start()