Skip to content

Commit

Permalink
Fix flipped printed cards and add function to generate flipped cards
Browse files Browse the repository at this point in the history
for use with the future scanner/card loader
  • Loading branch information
asl97 committed Dec 9, 2023
1 parent 0d1ca0d commit 59a9cad
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -935,12 +935,23 @@ <h1>Batch Card Printer</h1>
}

arr_2d_to_3d(arr, length){
let arr_3d = Array(length).fill().map(()=>[]);
arr.forEach((x,i)=>arr_3d[Math.floor(i/length)].push(x))

return arr_3d
}

arr_2d_to_3d_flipped(arr, length){
let arr_3d = Array(length).fill().map(()=>[]);
arr.forEach((x,i)=>arr_3d[i%length].push(x))

return arr_3d
}

arr_2d_flip(arr, length){
return this.arr_3d_to_2d(this.arr_2d_to_3d_flipped(arr, length));
}

arr_3d_to_2d(arr){
if (arr.flat){
return arr.flat();
Expand Down

0 comments on commit 59a9cad

Please sign in to comment.