<commit_before>local v2 = require 'dokidoki.v2'

-- returns the closest target of the given type
function get_nearest_of_type(source, ship_type)
  local ships = game.actors.get(ship_type)

  -- find the closest one!
  local closest_ship
  local closest_square_magnitude

  for _, ship in ipairs(ships) do
    local square_magnitude =
      v2.sqrmag(ship.transform.pos - source.transform.pos)
    if not closest_ship or square_manitude < closest_square_manitude then
      closest_ship = ship
      closest_square_magnitude = square_magnitude
    end
  end

  return closest_ship
end<commit_msg>Fixing a typo in targeting.<commit_after>local v2 = require 'dokidoki.v2'

-- returns the closest target of the given type
function get_nearest_of_type(source, ship_type)
  local ships = game.actors.get(ship_type)

  -- find the closest one!
  local closest_ship
  local closest_square_magnitude

  for _, ship in ipairs(ships) do
    local square_magnitude =
      v2.sqrmag(ship.transform.pos - source.transform.pos)
    if not closest_ship or square_magnitude < closest_square_magnitude then
      closest_ship = ship
      closest_square_magnitude = square_magnitude
    end
  end

  return closest_ship
end
{'fraction_non_alphanumeric': 0.05887230514096186, 'fraction_numerical': 0.004975124378109453, 'mean_word_length': 3.8669354838709675, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5361365', 'n_tokens_mistral': 392, 'n_tokens_neox': 376, 'n_words': 105}