diff --git a/index.html b/index.html index 3e8cdc9..0917537 100644 --- a/index.html +++ b/index.html @@ -846,7 +846,23 @@

Batch Card Printer

[/^cs(\d+)-(\d+)$/gi, (match)=>{ let arr = this.randomize_array(match[2], parseInt(match[1])); return arr.slice(0, 25); - }] + }], + [/^csb(\d+)-(\d+)$/gi, (match=>{ + let arr = this.randomize_array(match[2], parseInt(match[1])); + // an extra array for number that exceed the grouping length + // grouping length is gotten by dividing the total number by 5 + // and dropping the remainder. + // + // eg: in normal bingo 76 would be outside of the b i n g o + // groups, it should overflow into group b + let groups = Array(6).fill().map(()=>[]); + let group_range = Math.floor(arr.length/5); + arr.forEach((num, i)=>groups[Math.floor(num/group_range)].push(num)) + // excess numbers to be distributed + groups[5].forEach((num, i)=>groups[i].push(num)) + delete groups[5] + return this.arr_2d_flip(groups.map((x)=>x.slice(0,5)).flat(), 5) + })] ], to_arrays: function (c){return function* _(){