001 /**
002 * Created by IntelliJ IDEA.
003 * User: Wei Wang
004 * Date: Nov 27, 2002
005 * Time: 10:19:18 PM
006 */
007
008 package EVolve.util.Painters;
009
010 import EVolve.visualization.*;
011 import java.awt.*;
012
013 public class PredictionPainter extends Painter{
014 protected Color colorRed = new Color(255, 0, 0);
015 protected Color colorBlue = new Color(120, 160, 255);
016 protected Predictor[] predictor; // predictors
017 protected int[] miss;
018
019 public PredictionPainter() {
020
021 }
022
023 public PredictionPainter(Predictor[] predictor) {
024 this.predictor = predictor;
025 miss = new int[predictor.length];
026 for (int i = 0; i < predictor.length; i++) {
027 miss[i] = 0;
028 }
029 }
030
031 public void paint(AutoImage image, int x, int y, int z) {
032 predictor[y].newTarget(z);
033
034 if (predictor[y].isCorrect()) {
035 if (image.getColor(x, y) == null) {
036 image.setColor(x, y, colorBlue);
037 }
038 } else {
039 image.setColor(x, y, colorRed);
040 miss[y]++;
041 }
042 }
043
044 public int[] getMiss() {
045 return miss;
046 }
047 }