Nonoblock: Difference between revisions
Content added Content deleted
m (Use ternary) |
|||
Line 935: | Line 935: | ||
const gapPerms = (grpSize, numGaps, minVal = 0) => { |
const gapPerms = (grpSize, numGaps, minVal = 0) => { |
||
const maxVal = numGaps - grpSize * minVal + minVal; |
const maxVal = numGaps - grpSize * minVal + minVal; |
||
⚫ | |||
⚫ | |||
const noInnerZero = compose(inv, hasInnerZero); |
|||
return maxVal <= 0 |
return maxVal <= 0 |
||
? (grpSize === 2 ? [[0]] : []) |
? (grpSize === 2 ? [[0]] : []) |
||
: |
: looper(mkArr(grpSize, minVal), maxVal)[1]; |
||
⚫ | |||
⚫ | |||
} |
} |
||
const test = (cells, ...blocks) => { |
const test = (cells, ...blocks) => { |
||
⚫ | |||
const grpSize = blocks.length + 1; |
const grpSize = blocks.length + 1; |
||
const numGaps = cells - sumArr(blocks); |
const numGaps = cells - sumArr(blocks); |
||
// Filter functions |
|||
⚫ | |||
⚫ | |||
// Output formatting |
|||
const combine = zipArr([...blocks]); |
const combine = zipArr([...blocks]); |
||
const choices = toBin(choose(0, 1)); |
const choices = toBin(choose(0, 1)); |
||
const output = compose(console.log, arrJoin('')); |
const output = compose(console.log, arrJoin(''), choices, combine); |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
.map(output); |
|||
}; |
}; |
||