<commit_before>var async = require('async');
var zlib = require('zlib');

var blockfile = require('./blockfile');
var btreedb = require('./btreedb');
var sbon = require('./sbon');

var TILES_X = 32;
var TILES_Y = 32;
var TILES_PER_REGION = TILES_X * TILES_Y;

var BYTES_PER_TILE = 23;
var BYTES_PER_ROW = BYTES_PER_TILE * TILES_X;
var BYTES_PER_REGION = BYTES_PER_TILE * TILES_PER_REGION;

var METADATA_KEY = <KEY>';

var regionProto = {
  getBackground: function (x, y) {
    var offset = this.getTileOffset(x, y);
    return [
      // Material id
      this.tileView.getInt16(offset + 7),
      // Hue shift
      this.tileView.getUint8(offset + 9),
      // Variant?
      this.tileView.getUint8(offset + 10),
      // Mod
      this.tileView.getInt16(offset + 11),
      // Mod hue shift
      this.tileView.getUint8(offset + 13)
    ];
  },

  getForeground: function (x, y) {
    var offset = this.getTileOffset(x, y);
    return [
      // Material id
      this.tileView.getInt16(offset),
      // Hue shift
      this.tileView.getUint8(offset + 2),
      // Variant?
      this.tileView.getUint8(offset + 3),
      // Mod
      this.tileView.getInt16(offset + 4),
      // Mod hue shift
      this.tileView.getUint8(offset + 6)
    ];
  },

  getMetadata: function (x, y) {
    var offset = this.getTileOffset(x, y);
    return [
      // Liquid
      this.tileView.getUint8(offset + 14),
      // Liquid pressure
      this.tileView.getUint16(offset + 15),
      // Collision map
      this.tileView.getUint8(offset + 17),
      // ?
      this.tileView.getInt16(offset + 18),
      // Biome?
      this.tileView.getUint8(offset + 20),
      // Biome?
      this.tileView.getUint8(offset + 21),
      // Indestructible
      !!this.tileView.getUint8(offset + 22)
    ];
  },

  getTileOffset: function (x, y) {
    return BYTES_PER_REGION - BYTES_PER_ROW * y + BYTES_PER_TILE * x;<commit_msg>Fix off-by-one error<commit_after>var async = require('async');
var zlib = require('zlib');

var blockfile = require('./blockfile');
var btreedb = require('./btreedb');
var sbon = require('./sbon');

var TILES_X = 32;
var TILES_Y = 32;
var TILES_PER_REGION = TILES_X * TILES_Y;

var BYTES_PER_TILE = 23;
var BYTES_PER_ROW = BYTES_PER_TILE * TILES_X;
var BYTES_PER_REGION = BYTES_PER_TILE * TILES_PER_REGION;

var METADATA_KEY = '\<KEY>';

var regionProto = {
  getBackground: function (x, y) {
    var offset = this.getTileOffset(x, y);
    return [
      // Material id
      this.tileView.getInt16(offset + 7),
      // Hue shift
      this.tileView.getUint8(offset + 9),
      // Variant?
      this.tileView.getUint8(offset + 10),
      // Mod
      this.tileView.getInt16(offset + 11),
      // Mod hue shift
      this.tileView.getUint8(offset + 13)
    ];
  },

  getForeground: function (x, y) {
    var offset = this.getTileOffset(x, y);
    return [
      // Material id
      this.tileView.getInt16(offset),
      // Hue shift
      this.tileView.getUint8(offset + 2),
      // Variant?
      this.tileView.getUint8(offset + 3),
      // Mod
      this.tileView.getInt16(offset + 4),
      // Mod hue shift
      this.tileView.getUint8(offset + 6)
    ];
  },

  getMetadata: function (x, y) {
    var offset = this.getTileOffset(x, y);
    return [
      // Liquid
      this.tileView.getUint8(offset + 14),
      // Liquid pressure
      this.tileView.getUint16(offset + 15),
      // Collision map
      this.tileView.getUint8(offset + 17),
      // ?
      this.tileView.getInt16(offset + 18),
      // Biome?
      this.tileView.getUint8(offset + 20),
      // Biome?
      this.tileView.getUint8(offset + 21),
      // Indestructible
      !!this.tileView.getUint8(offset + 22)
    ];
  },

  getTileOffset: function (x, y) {
    return BYTES_PER_REGION - BYTES_PER_ROW * (y + 1) + BYTES_PER_TILE * x;
{'fraction_non_alphanumeric': 0.13687516356974613, 'fraction_numerical': 0.02904998691442031, 'mean_word_length': 2.443243243243243, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1141586', 'n_tokens_mistral': 1461, 'n_tokens_neox': 1382, 'n_words': 276}