<commit_before>﻿var replayContext;
const tileDepth = 0.78;
const tileWidth = 0.97;
const tileHeight = 1.28;
const gap = 0.2;

function initReplay() {
    replayContext = new RenderContext("replayCanvas");
    replayContext.setCameraPosition(0, -21, 31);
    replayCreateLights();

    replayContext.createTiles(() => arrange());
}

function arrange() {
    const input = document.querySelector("#gameDataJson");
    const json = input.value;
    const data = JSON.parse(json);
    const wall = data.slice(0, 136);
    const dice = data.slice(136, 138);

    createWall(wall, dice, 0);
    createPond();
    createHands();
}

function createWall(wall, dice, oyaId) {
    const layoutOffset = -(17 * tileWidth + tileHeight + gap) / 2;

    const diceSum = dice[0] + dice[1];
    const wallOffset = 142 - (((19 - diceSum - oyaId) * 34 + diceSum * 2) % 136);

    var wallId = 0;

    for (let i = 0; i < 4; i++) {
        let x = layoutOffset + 0.5 * tileWidth + tileHeight + gap;
        const y = layoutOffset + 0.5 * tileHeight;
        for (let j = 0; j < 17; j++) {
            for (let k = 0; k < 2; k++) {
                const shiftedId = (wallId + wallOffset) % 136;
                if (shiftedId === 0) {
                    x += gap;
                }
                const tileId = wall[shiftedId];<commit_msg>fixed wall split calculation<commit_after>﻿var replayContext;
const tileDepth = 0.78;
const tileWidth = 0.97;
const tileHeight = 1.28;
const gap = 0.2;

function initReplay() {
    replayContext = new RenderContext("replayCanvas");
    replayContext.setCameraPosition(0, -21, 31);
    replayCreateLights();

    replayContext.createTiles(() => arrange());
}

function arrange() {
    const input = document.querySelector("#gameDataJson");
    const json = input.value;
    const data = JSON.parse(json);
    const wall = data.slice(0, 136);
    const dice = data.slice(136, 138);

    createWall(wall, dice, 0);
    createPond();
    createHands();
}

function createWall(wall, dice, oyaId) {
    const layoutOffset = -(17 * tileWidth + tileHeight + gap) / 2;

    const diceSum = dice[0] + dice[1];
    const wallOffset = ((20 - diceSum - oyaId) * 34 + diceSum * 2) % 136;

    var wallId = 0;

    for (let i = 0; i < 4; i++) {
        let x = layoutOffset + 0.5 * tileWidth + tileHeight + gap;
        const y = layoutOffset + 0.5 * tileHeight;
        for (let j = 0; j < 17; j++) {
            for (let k = 0; k < 2; k++) {
                const shiftedId = (wallId + wallOffset) % 136;
                if (shiftedId === 0) {
                    x += gap;
                }
                const tileId = wall[shiftedId];
{'fraction_non_alphanumeric': 0.14026465028355387, 'fraction_numerical': 0.043478260869565216, 'mean_word_length': 2.3536121673003803, 'pattern_counts': {'":': 0, '<': 9, '<?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': '1458758', 'n_tokens_mistral': 949, 'n_tokens_neox': 841, 'n_words': 247}