Making of LLemMings

Replacing Climber and bounds checks

ChatGPT: Climber implementation


>>> Prompt for missing functions:
Given this example:
function getPixelColor(imageData, x, y) {
x = Math.round(x);
y = Math.round(y);
const index = ((y * width) + x) * 4;
const r = imageData.data[index];
const g = imageData.data[index + 1];
const b = imageData.data[index + 2];
const a = imageData.data[index + 3];

return [r, g, b, a];
}

Give me the function called getPixelIndex

>>>> Prompt: to make changes to Lemming.update() regarding bounds-checking
Rewrite this whole method to make sure we do not attempt to check pixels that are out of bounds of the canvas:
Make sure to check bounds so that e.g. getPixelIndex() does not attempt to get out of bounds
pixels either.

(and then the full update() method was passed in)

>>> Catch-up notes:
Backup was named: 'index - Copy (40) - ditching suggested climber code.html'
Associated LLM context: You-bounds-fix-of-update-method.md