Example scan:

(function() const canvas = document.querySelector('canvas'); if (!canvas) return; const ctx = canvas.getContext('2d'); function getPixelColor(x, y) const pixel = ctx.getImageData(x, y, 1, 1).data; return r: pixel[0], g: pixel[1], b: pixel[2] ;

update(); )();

To move: canvas.dispatchEvent(new MouseEvent('mousemove', clientX, clientY))

To split: window.dispatchEvent(new KeyboardEvent('keydown', key: ' ', keyCode: 32))

function findPlayerCell() // Scan center-ish region for non-green/white colors typical of player // Actually easier: track mouse position? No – better to detect dark outline or your name. // We'll simplify: assume player is at canvas center (camera follows your cell). return x: canvas.width/2, y: canvas.height/2 ;

function moveTowards(angle) // Simulate mouse movement to steer. const dx = Math.cos(angle) * 100; const dy = Math.sin(angle) * 100; const event = new MouseEvent('mousemove', clientX: canvas.getBoundingClientRect().left + canvas.width/2 + dx, clientY: canvas.getBoundingClientRect().top + canvas.height/2 + dy, ); canvas.dispatchEvent(event);