<commit_before>// Block properties
// Non-solid: Null color blocks act as air.
// Solid: The block can be swapped with other blocks and air and is displayed displayed by the UI.
// Floating: If a block has air under it, it will start to float and hang in the air for a while (floatTimer > 0).
// Falling: The float timer has ran out and the block is in free fall one unit per time step (floatTimer == 0).
// Landed: The block has a solid block beneath it and is no longer in free fall (floatTimer < 0).
// Flashing: The block is part of a match (of 3 or more) and will soon turn into air (flashTimer >= 0).
// Chaining: The block is part of a continuous chain where blocks from a previous match drop into a new match (chaining == true).
// Swapping: The block has begun swapping and is on its way to the new location (swapTimer != 0).

const JKISS31 = require('./jkiss');

const STATE_CACHE_SIZE = 16;
const defaultOptions = {
  width: 6,
  height: 8,
  flashTime: 3,
  floatTime: 3,
  swapTime: 2,
  initialRows: 3,
};

function blocksValid(block1, block2) {
  if (!block1 || !block2) {
    return false;
  }
  if (block1.flashTimer >= 0 || block2.flashTimer >= 0) {
    return false;
  }
  if (block1.floatTimer > 0 || block2.floatTimer > 0) {
    return false;
  }

  return true;
}

function blocksCanSwap(block1, block2) {
  return blocksValid(block1, block2);
}

function blocksMatch(block1, block2) {
  if (!blocksValid(block1, block2)) {
    return false;
  }
  if (block1.floatTimer === 0 || block2.floatTimer === 0) {
    return false;
  }
  if (!block1.color || !block2.color) {
    return false;
  }
  if (block1.swapTimer !== 0 || block2.swapTimer !== 0) {
    return false;
  }
  if (block1.color === block2.color) {
    return (!block1.preventMatching && !block2.preventMatching);
  }
  return false;<commit_msg>Remove floating restrictions from swapping<commit_after>// Block properties
// Non-solid: Null color blocks act as air.
// Solid: The block can be swapped with other blocks and air and is displayed displayed by the UI.
// Floating: If a block has air under it, it will start to float and hang in the air for a while (floatTimer > 0).
// Falling: The float timer has ran out and the block is in free fall one unit per time step (floatTimer == 0).
// Landed: The block has a solid block beneath it and is no longer in free fall (floatTimer < 0).
// Flashing: The block is part of a match (of 3 or more) and will soon turn into air (flashTimer >= 0).
// Chaining: The block is part of a continuous chain where blocks from a previous match drop into a new match (chaining == true).
// Swapping: The block has begun swapping and is on its way to the new location (swapTimer != 0).

const JKISS31 = require('./jkiss');

const STATE_CACHE_SIZE = 16;
const defaultOptions = {
  width: 6,
  height: 8,
  flashTime: 3,
  floatTime: 3,
  swapTime: 2,
  initialRows: 3,
};

function blocksCanSwap(block1, block2) {
  if (!block1 || !block2) {
    return false;
  }
  if (block1.flashTimer >= 0 || block2.flashTimer >= 0) {
    return false;
  }

  return true;
}

function blocksMatch(block1, block2) {
  if (!block1 || !block2) {
    return false;
  }
  if (block1.flashTimer >= 0 || block2.flashTimer >= 0) {
    return false;
  }
  if (block1.floatTimer >= 0 || block2.floatTimer >= 0) {
    return false;
  }
  if (!block1.color || !block2.color) {
    return false;
  }
  if (block1.swapTimer !== 0 || block2.swapTimer !== 0) {
    return false;
  }
  if (block1.color === block2.color) {
    return (!block1.preventMatching && !block2.preventMatching);
  }
  return false;
{'fraction_non_alphanumeric': 0.11438908989702198, 'fraction_numerical': 0.026718619537990537, 'mean_word_length': 3.304191616766467, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '6907547', 'n_tokens_mistral': 1187, 'n_tokens_neox': 1131, 'n_words': 465}