package com.bert.pixels.models;

import java.util.function.BinaryOperator;

/**
 * Possible colors for a pixel
 */
public enum Color {
  /**
   * Red pixels can only more right.
   */
  R(Integer::sum),
  /**
   * Yellow pixels can only more left.
   */
  Y((a, b) -> a - b);

  private final BinaryOperator<Integer> moveFunction;

  Color(BinaryOperator<Integer> moveFunction) {
    this.moveFunction = moveFunction;
  }

  public Integer apply(Pixel pixel, int speed) {
    return this.moveFunction.apply(pixel.getPosition(), speed);
  }

  public Character toChar() {
    return this.name().charAt(0);
  }
}

@@ -412,24 +412,182 @@
 ction;%0A  %7D%0A%0A
+  /**%0A   * @param pixel the pixel to apply the movement to%0A   * @param speed the speed of the movement%0A   * @return the resulting position of the pixel%0A   */%0A
   public Int
@@ -692,16 +692,90 @@
 );%0A  %7D%0A%0A
+  /**%0A   * @return the single character representation of the Color%0A   */%0A
   public

Update javadoc