Skip to content

Commit

Permalink
Merge pull request TodePond#356 from Paalui/patch-1
Browse files Browse the repository at this point in the history
Added rounding in conditionFunction and fixed merging
  • Loading branch information
TodePond authored Jul 9, 2024
2 parents c777c93 + a4dce1a commit 99e0611
Showing 1 changed file with 35 additions and 18 deletions.
53 changes: 35 additions & 18 deletions the-one-true-todey-file-of-cellpond.js
Original file line number Diff line number Diff line change
Expand Up @@ -2165,10 +2165,10 @@ on.load(() => {
const neighbour = pickCell(centerX, centerY)

if (neighbour === undefined) return [undefined, undefined]
if (neighbour.left !== x) return [undefined, undefined]
if (neighbour.top !== y) return [undefined, undefined]
if (neighbour.width !== width) return [undefined, undefined]
if (neighbour.height !== height) return [undefined, undefined]
if (neighbour.left+8 !== x+8) return [undefined, undefined]
if (neighbour.top+8 !== y+8) return [undefined, undefined]
if (neighbour.width+8 !== width+8) return [undefined, undefined]
if (neighbour.height+8 !== height+8) return [undefined, undefined]
if (!splashes.has(neighbour.colour)) return [undefined, undefined]

return [neighbour, cell.content.stamp]
Expand Down Expand Up @@ -2257,8 +2257,8 @@ on.load(() => {
if (bonusTargets.length === 0) {
neighbourId++
if (skip > 0) {
neighbourId++
skip--
neighbourId+= skip
skip = 0
}
}
}
Expand Down Expand Up @@ -8310,6 +8310,7 @@ registerRule(
//======//
// LEFT //
//======//
let miniCount = 0
if (cellAtom.isLeftSlot) {

const red = makeNumber({values: [true, true, true, true, true, true, true, true, true, true], channel: 0})
Expand Down Expand Up @@ -8337,6 +8338,7 @@ registerRule(
content: miniClone,
})
left.push(diagramCell)
miniCount++
}

} else {
Expand All @@ -8352,24 +8354,39 @@ registerRule(
//=======//
// RIGHT //
//=======//
const rightContent = cellAtom.slotted === undefined? undefined : cellAtom.slotted.value

// Merge!!!
if (!cellAtom.isLeftSlot && cellAtom.value.isDiagram) {
const maxiLeft = makeMaximisedDiagram(cellAtom.value)
const [maxiWidth, maxiHeight] = getDiagramDimensions(maxiLeft)

const mergeCell = makeDiagramCell({
x,
y,
instruction: DRAGON_INSTRUCTION.merge,
splitX: maxiWidth,
splitY: maxiHeight,
})

right.push(mergeCell)
if (rightContent === undefined) {
while(miniCount>1){
const nothingCell = makeDiagramCell({
x,
y,
instruction: DRAGON_INSTRUCTION.nothing,
})

right.push(nothingCell)
miniCount--
}
}
else{
const maxiLeft = makeMaximisedDiagram(cellAtom.value)
const [maxiWidth, maxiHeight] = getDiagramDimensions(maxiLeft)

const mergeCell = makeDiagramCell({
x,
y,
instruction: DRAGON_INSTRUCTION.merge,
splitX: maxiWidth,
splitY: maxiHeight,
})

right.push(mergeCell)
}
}

const rightContent = cellAtom.slotted === undefined? undefined : cellAtom.slotted.value

if (rightContent === undefined) {
const nothingCell = makeDiagramCell({
Expand Down

0 comments on commit 99e0611

Please sign in to comment.