Skip to content

Commit

Permalink
Multicells got merged if the right side was empty
Browse files Browse the repository at this point in the history
When updating paddle rules, if there is a multicell on the left hand it always gets merged first, even if there is nothing in the right side. 
I changed it to add a nothing instrution for every minicell instead of merging if the cell shouldn't change.
  • Loading branch information
Paalui authored Jul 8, 2024
1 parent 62c4535 commit a4dce1a
Showing 1 changed file with 29 additions and 12 deletions.
41 changes: 29 additions & 12 deletions the-one-true-todey-file-of-cellpond.js
Original file line number Diff line number Diff line change
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 a4dce1a

Please sign in to comment.