Skip to content

Commit

Permalink
give each RobotFamily a retrievable Color (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rdeisenroth authored Jun 18, 2024
1 parent 980693f commit 73e6765
Showing 1 changed file with 36 additions and 11 deletions.
47 changes: 36 additions & 11 deletions src/main/java/fopbot/RobotFamily.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package fopbot;

import java.awt.Color;

/**
* An enumeration of robot families.
* A family of robots is uniquely in terms of their appearance.
Expand All @@ -8,43 +10,66 @@ public enum RobotFamily {
/**
* A Blue Triangle robot.
*/
TRIANGLE_BLUE,
TRIANGLE_BLUE(Color.BLUE),
/**
* A Teal Square robot.
*/
SQUARE_AQUA,
SQUARE_AQUA(Color.CYAN),
/**
* A Black Square robot.
*/
SQUARE_BLUE,
SQUARE_BLUE(Color.BLUE),
/**
*A Green Square robot.
* A Green Square robot.
*/
SQUARE_GREEN,
SQUARE_GREEN(Color.GREEN),
/**
* An Orange Square robot.
*/
SQUARE_ORANGE,
SQUARE_ORANGE(Color.ORANGE),
/**
* A Purple Square robot.
*/
SQUARE_PURPLE,
SQUARE_PURPLE(Color.MAGENTA),
/**
* A Red Square robot.
*/
SQUARE_RED,
SQUARE_RED(Color.RED),
/**
* A Yellow Square robot.
*/
SQUARE_YELLOW,
SQUARE_YELLOW(Color.YELLOW),
/**
* A Black Square robot.
*/
SQUARE_BLACK,
SQUARE_BLACK(Color.BLACK),
/**
* A White Square robot.
*/
SQUARE_WHITE;
SQUARE_WHITE(Color.WHITE);

/**
* The color of this robot family.
*/
private final Color color;

/**
* Creates a new robot family with the given color.
*
* @param color the color of the robot family
*/
RobotFamily(final Color color) {
this.color = color;
}

/**
* Returns the color of this robot family.
*
* @return the color of this robot family
*/
public Color getColor() {
return color;
}

/**
* Returns the identifier of this robot family.
Expand Down

0 comments on commit 73e6765

Please sign in to comment.