import { readData, Data, getBitsNumbers, getReflectionIndex, transpose } from "./solver.ts";

const input = await Deno.readTextFile("input.txt");
const maps = readData(input);

let verticalSum=0, horizontalSum = 0;
maps.forEach((map, index) => {
    console.log("map", index);
    const horizontal = map.map(x=> getBitsNumbers(x));
    const vertical = transpose(map).map(x=> getBitsNumbers(x));

    const hi = getReflectionIndex(horizontal);
    const vi = getReflectionIndex(vertical);

    if (hi > 0){
        horizontalSum += hi;
    }
    if (vi > 0){
        verticalSum += vi;
    }
    console.log(hi, vi);
});

console.log(horizontalSum * 100 + verticalSum);