All pastes #542610 Raw Edit

Miscellany

public java v1 · immutable
·published 2007-06-05 21:47 UTC
rendered paste body
import java.awt.Graphics;import impsoft.nexus.bots.color.ColorBot;import impsoft.nexus.bots.color.scriptable.ColorScript;import impsoft.nexus.bots.color.scriptable.interfaces.AutoPaint;public class edges extends ColorScript {	public edges(ColorBot b) {		super(b);	}	public void script() throws InterruptedException, Exception {		Matrix m = new Matrix(true);		Matrix m2 = new Matrix(new double[][] { { 2, 4, 5, 4, 2 },				{ 4, 9, 12, 9, 4 }, { 5, 12, 15, 12, 15 }, { 4, 9, 12, 9, 4 },				{ 2, 4, 5, 4, 2 } });		Matrix m3 = new Matrix(false);		while (true) {			waitTillNextFrame();			short[][][] x2 = getColorMap();			short[][][] x = m.applyToColorMap(x2);			x2 = m3.applyToColorMap(x2);			for (int xy = 0; xy < x.length; xy++) {				for (int yy = 0; yy < x[0].length; yy++) {					for (int i = 0; i < 3; i++) {						x[xy][yy][i] = (short) ((x[xy][yy][i] + x2[xy][yy][i]) / 2);					}				}			}			paintColorMap(x, 0, 0, 1000);		}	}}