Code edit (9 edits merged)
Please save this source code
User prompt
Write the getConnectedBubbles function for the grid. It should return the list of unique bubbles of the same type passed to the method such that you get a list of all connected bubbles. Note that the grid is hexagonal in nature, the method should handle that.
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'var visited = new Set();' Line Number: 50
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'var neighbors = self.getNeighbors(currentBubble);' Line Number: 56
User prompt
In the grid class, implement the getNeighbors method
Code edit (5 edits merged)
Please save this source code
User prompt
implement //Method that removes an array of bubbles from the rows array. self.removeBubbles = function (bubbels) {};
User prompt
In the method //Method that removes an array of bubbles from the rows array. self.removeBubbles = function (bubbles) { for (var i = 0; i < bubbles.length; i++) { var bubble = bubbles[i]; var bubbleIndex = this.findBubbleIndex(bubble); if (bubbleIndex) { rows[bubbleIndex.row].splice(bubbleIndex.col, 1); bubble.destroy(); } } }; The array indexes must be maintained. When removing a bubble from rows, the index should simply be set to null
Code edit (2 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'self.removeBubbles(bubbels);' Line Number: 45
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'if (neighbor.type === bubble.type) {' Line Number: 74
Code edit (4 edits merged)
Please save this source code
User prompt
Write this method //Method that gets all bubbles which are not, or do not have a recursive neighbour that is connected to the top row of bubblels self.getDetachedBubbles = function () {};
Code edit (5 edits merged)
Please save this source code
User prompt
Implement this //Get a list of bubbles that are not connected to the top row, or to a chain of bubbles connected to the top row. self.getDetachedBubbles = function () {}; Note that all unconnected bubbles must be detected
Code edit (1 edits merged)
Please save this source code
User prompt
getDetachedBubbles does not seem to detect all unconnected bubbles, please fix this
User prompt
Implement this //Get a list of bubbles that are not connected to the top row, or to a chain of bubbles connected to the top row. self.getDetachedBubbles = function () {}; Note that all unconnected bubbles must be detected
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'var visited = new Set(connectedToTop);' Line Number: 98
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'return bubble !== undefined;' Line Number: 99
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'return bubble !== null;' Line Number: 99
User prompt
In var visited = new Set(connectedToTop.filter(function (bubble) { return bubble != null; })); LK does not support Set, please fix this
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'if (bubble !== null && !visited.has(bubble)) {' Line Number: 105
===================================================================
--- original.js
+++ change.js
@@ -89,9 +89,9 @@
}
}
// Mark all bubbles as visited or not
var visited = new Set(connectedToTop.filter(function (bubble) {
- return bubble !== undefined;
+ return bubble !== null;
}));
// Find all bubbles that are not visited and not connected to the top
for (var row = 1; row < rows.length; row++) {
for (var col = 0; col < rows[row].length; col++) {
Circular white gradient circle on black background. Gradient from white on the center to black on the outer edge all around.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Soft straight Long red paint on black background. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Fire ball. Bubble shooter game. Thin black outline.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
green notification bubble. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.