merge GUI

This commit is contained in:
2018-03-30 16:44:22 +02:00
6 changed files with 504 additions and 447 deletions

View File

@@ -73,451 +73,454 @@ import worms.util.MustNotImplementException;
public interface IFacade { public interface IFacade {
/************ /************
* WORLD * WORLD
************/ ************/
/** /**
* Create a new world with given width and given height. * Create a new world with given width and given height.
* The passable map is a rectangular matrix indicating which parts of the terrain * The passable map is a rectangular matrix indicating which parts of the terrain
* are passable and which parts are impassable. * are passable and which parts are impassable.
* This matrix is derived from the transparency of the pixels in the image file * This matrix is derived from the transparency of the pixels in the image file
* of the terrain. passableMap[r][c] is true if the location at row r and column c * of the terrain. passableMap[r][c] is true if the location at row r and column c
* is passable, and false if that location is impassable. * is passable, and false if that location is impassable.
* The elements in the first row (row 0) represent the pixels at the top of the * The elements in the first row (row 0) represent the pixels at the top of the
* terrain (i.e., largest y-coordinates). * terrain (i.e., largest y-coordinates).
* The elements in the last row (row passableMap.length-1) represent pixels at the * The elements in the last row (row passableMap.length-1) represent pixels at the
* bottom of the terrain (smallest y-coordinates). * bottom of the terrain (smallest y-coordinates).
* The elements in the first column (column 0) represent the pixels at the left * The elements in the first column (column 0) represent the pixels at the left
* of the terrain (i.e., smallest x-coordinates). * of the terrain (i.e., smallest x-coordinates).
* The elements in the last column (column passableMap[0].length-1) represent the * The elements in the last column (column passableMap[0].length-1) represent the
* pixels at the right of the terrain (i.e., largest x-coordinates). * pixels at the right of the terrain (i.e., largest x-coordinates).
*/ */
public World createWorld(double width, double height, public World createWorld(double width, double height,
boolean[][] passableMap) throws ModelException; boolean[][] passableMap) throws ModelException;
/** /**
* Terminate the given world. * Terminate the given world.
*/ */
void terminate(World world) throws ModelException; void terminate(World world) throws ModelException;
/** /**
* Check whether the given worls is terminated. * Check whether the given worls is terminated.
*/ */
boolean isTerminated(World world) throws ModelException; boolean isTerminated(World world) throws ModelException;
/** /**
* Return the width of the given world. * Return the width of the given world.
*/ */
public double getWorldWidth(World world) throws ModelException; public double getWorldWidth(World world) throws ModelException;
/** /**
* Return the height of the given world. * Return the height of the given world.
*/ */
public double getWorldHeight(World world) throws ModelException; public double getWorldHeight(World world) throws ModelException;
/** /**
* Check whether the given world is passable at the given location. * Check whether the given world is passable at the given location.
* - The location is an array containing the x-coordinate of the location to * - The location is an array containing the x-coordinate of the location to
* check followed by the y-coordinate of that location. * check followed by the y-coordinate of that location.
* - Locations outside the boundaries of the world are always passable. * - Locations outside the boundaries of the world are always passable.
*/ */
boolean isPassable(World world, double[] location) throws ModelException; boolean isPassable(World world, double[] location) throws ModelException;
/** /**
* Check whether the circular area with given center and given radius * Check whether the circular area with given center and given radius
* is passable in the given world. * is passable in the given world.
* - The circular area must not lie completely within the given world. * - The circular area must not lie completely within the given world.
*/ */
boolean isPassable(World world, double[] center, double radius); boolean isPassable(World world, double[] center, double radius);
/** /**
* Check whether the circular area with given center and given radius * Check whether the circular area with given center and given radius
* is adjacent to impassable terrain in the given world. * is adjacent to impassable terrain in the given world.
* - The circular area must not lie completely within the given world. * - The circular area must not lie completely within the given world.
*/ */
boolean isAdjacent(World world, double[] center, double radius); boolean isAdjacent(World world, double[] center, double radius);
/** /**
* Check whether the given world contains the given worm. * Check whether the given world contains the given worm.
*/ */
boolean hasAsWorm(World world, Worm worm) throws ModelException; boolean hasAsWorm(World world, Worm worm) throws ModelException;
/** /**
* Add the given worm to the given world. * Add the given worm to the given world.
*/ */
void addWorm(World world, Worm worm) throws ModelException; void addWorm(World world, Worm worm) throws ModelException;
/** /**
* Remove the given worm from the given world. * Remove the given worm from the given world.
*/ */
void removeWorm(World world, Worm worm) throws ModelException; void removeWorm(World world, Worm worm) throws ModelException;
/** /**
* Return a list filled with all the worms in the given world. * Return a list filled with all the worms in the given world.
*/ */
List<Worm> getAllWorms(World world) throws ModelException; List<Worm> getAllWorms(World world) throws ModelException;
/** /**
* Check whether the given world contains the given food. * Check whether the given world contains the given food.
*/ */
boolean hasAsFood(World world, Food food) throws ModelException; boolean hasAsFood(World world, Food food) throws ModelException;
/** /**
* Add the given portion of food to the given world. * Add the given portion of food to the given world.
*/ */
void addFood(World world, Food food) throws ModelException; void addFood(World world, Food food) throws ModelException;
/** /**
* Remove the given portion of food from the given world. * Remove the given portion of food from the given world.
*/ */
void removeFood(World world, Food food) throws ModelException; void removeFood(World world, Food food) throws ModelException;
/** /**
* Return a collection filled with all the worms and all the * Return a collection filled with all the worms and all the
* portions of food in the given world. * portions of food in the given world.
*/ */
Collection<Object> getAllItems(World world) throws ModelException; Collection<Object> getAllItems(World world) throws ModelException;
/** /**
* Return a set of all the team in the given world. * Return a set of all the team in the given world.
*/ */
Set<Team> getAllTeams(World world) throws ModelException; Set<Team> getAllTeams(World world) throws ModelException;
/** /**
* Check whether the given world has an active game. * Check whether the given world has an active game.
*/ */
boolean hasActiveGame(World world) throws ModelException; boolean hasActiveGame(World world) throws ModelException;
/** /**
* Return the active worm in the given world. * Return the active worm in the given world.
* - The active worm is the worm whose turn it is to perform * - The active worm is the worm whose turn it is to perform
* player-controlled actions. * player-controlled actions.
*/ */
Worm getActiveWorm(World world) throws ModelException; Worm getActiveWorm(World world) throws ModelException;
/** /**
* Start a new game in the given world. * Start a new game in the given world.
*/ */
void startGame(World world) throws ModelException; void startGame(World world) throws ModelException;
/** /**
* Finish the current game, if any, in the given world. * Finish the current game, if any, in the given world.
*/ */
void finishGame(World world) throws ModelException; void finishGame(World world) throws ModelException;
/** /**
* Activate the next worm in the given world. * Activate the next worm in the given world.
*/ */
void activateNextWorm(World world) throws ModelException; void activateNextWorm(World world) throws ModelException;
/** /**
* Return the name of a single worm if that worm is the winner, or the name * Return the name of a single worm if that worm is the winner, or the name
* of a team if that team is the winner and the team still has several members. * of a team if that team is the winner and the team still has several members.
*/ */
String getWinner(World world); String getWinner(World world);
/************ /************
* WORM * WORM
************/ ************/
/** /**
* Create and return a new worm that is positioned at the given location in * Create and return a new worm that is positioned at the given location in
* the given world, that looks in the given direction, that has the given radius * the given world, that looks in the given direction, that has the given radius
* and the given name, and that is a member of the given team. * and the given name, and that is a member of the given team.
* - If the given world is not effective, the new worm is simply positioned * - If the given world is not effective, the new worm is simply positioned
* at the given location. * at the given location.
* - If the given team is not effective, the new worm is not part of any team. * - If the given team is not effective, the new worm is not part of any team.
* The location is an array containing the x-coordinate of the location of * The location is an array containing the x-coordinate of the location of
* the new worm followed by the y-coordinate of that location. * the new worm followed by the y-coordinate of that location.
*/ */
Worm createWorm(World world, double[] location, double direction, double radius, Worm createWorm(World world, double[] location, double direction, double radius,
String name, Team team) throws ModelException; String name, Team team) throws ModelException;
/** /**
* Terminate the given worm. * Terminate the given worm.
*/ */
void terminate(Worm worm) throws ModelException; void terminate(Worm worm) throws ModelException;
/** /**
* Check whether the given worm is terminated. * Check whether the given worm is terminated.
*/ */
boolean isTerminated(Worm worm) throws ModelException; boolean isTerminated(Worm worm) throws ModelException;
/** /**
* Return the current location of the given worm. * Return the current location of the given worm.
* - The resulting array contains the the x-coordinate of the given worm * - The resulting array contains the the x-coordinate of the given worm
* followed by its y-coordinate. * followed by its y-coordinate.
*/ */
double[] getLocation(Worm worm) throws ModelException; double[] getLocation(Worm worm) throws ModelException;
/** /**
* Return the current orientation of the given worm (in radians). * Return the current orientation of the given worm (in radians).
*/ */
double getOrientation(Worm worm) throws ModelException; double getOrientation(Worm worm) throws ModelException;
/** /**
* Return the radius of the given worm. * Return the radius of the given worm.
*/ */
double getRadius(Worm worm) throws ModelException; double getRadius(Worm worm) throws ModelException;
/** /**
* Set the radius of the given worm to the given value. * Set the radius of the given worm to the given value.
*/ */
void setRadius(Worm worm, double newRadius) throws ModelException; void setRadius(Worm worm, double newRadius) throws ModelException;
/** /**
* Return the mass of the given worm. * Return the mass of the given worm.
*/ */
double getMass(Worm worm) throws ModelException; double getMass(Worm worm) throws ModelException;
/** /**
* Return the maximum number of action points of the given worm. * Return the maximum number of action points of the given worm.
*/ */
long getMaxNbActionPoints(Worm worm) throws ModelException; long getMaxNbActionPoints(Worm worm) throws ModelException;
/** /**
* Return the current number of action points of the given worm. * Return the current number of action points of the given worm.
*/ */
long getNbActionPoints(Worm worm) throws ModelException; long getNbActionPoints(Worm worm) throws ModelException;
/** /**
* Decrease the current number of action points of the given worm * Decrease the current number of action points of the given worm
* with the given delta. * with the given delta.
* - The given delta may be negative. * - The given delta may be negative.
*/ */
void decreaseNbActionPoints(Worm worm, long delta) throws ModelException; void decreaseNbActionPoints(Worm worm, long delta) throws ModelException;
/** /**
* Return the current number of hit points of the given worm. * Return the current number of hit points of the given worm.
*/ */
BigInteger getNbHitPoints(Worm worm) throws ModelException; BigInteger getNbHitPoints(Worm worm) throws ModelException;
/** /**
* Increment the current number of hit points of the given worm * Increment the current number of hit points of the given worm
* with the given delta. * with the given delta.
* - The given delta may be negative. * - The given delta may be negative.
*/ */
void incrementNbHitPoints(Worm worm, long delta) throws ModelException; void incrementNbHitPoints(Worm worm, long delta) throws ModelException;
/** /**
* Return the name the given worm. * Return the name the given worm.
*/ */
String getName(Worm worm) throws ModelException; String getName(Worm worm) throws ModelException;
/** /**
* Rename the given worm. * Rename the given worm.
*/ */
void rename(Worm worm, String newName) throws ModelException; void rename(Worm worm, String newName) throws ModelException;
/** /**
* Return the world to which this worm belongs * Return the world to which this worm belongs
*/ */
World getWorld(Worm worm) throws ModelException; World getWorld(Worm worm) throws ModelException;
/** /**
* Turn the given worm by the given angle. * Turn the given worm by the given angle.
*/ */
void turn(Worm worm, double angle); void turn(Worm worm, double angle);
/** /**
* Return the location the farthest away from its current location to which the given * Return the location the farthest away from its current location to which the given
* worm can move in the world in which that worm is positioned, if any, following * worm can move in the world in which that worm is positioned, if any, following
* the given direction and not exceeding the given maximum distance. * the given direction and not exceeding the given maximum distance.
* - The maximum distance must be finite and may not be negative. * - The maximum distance must be finite and may not be negative.
* - The given direction must be in the range [0.0 .. PI[. * - The given direction must be in the range [0.0 .. PI[.
* - On its road to the resulting location, the given worm will always be * - On its road to the resulting location, the given worm will always be
* positioned on passable terrain. * positioned on passable terrain.
* - The resulting position may be outside the boundaries of the world, if any, in * - The resulting position may be outside the boundaries of the world, if any, in
* which the given worm is located. * which the given worm is located.
*/ */
double[] getFurthestLocationInDirection(Worm worm, double direction, double maxDistance) throws ModelException; double[] getFurthestLocationInDirection(Worm worm, double direction, double maxDistance) throws ModelException;
/** /**
* Move the given worm according to the rules in the assignment. * Move the given worm according to the rules in the assignment.
*/ */
void move(Worm worm) throws ModelException; void move(Worm worm) throws ModelException;
/** /**
* Returns whether the given worm can fall. * Returns whether the given worm can fall.
* - Students working alone on the project must not override this method. * - Students working alone on the project must not override this method.
*/ */
default public boolean canFall(Worm worm) throws MustNotImplementException { default public boolean canFall(Worm worm) throws MustNotImplementException {
throw new MustNotImplementException(); throw new MustNotImplementException();
} }
/** /**
* Makes the given worm fall down until it rests on impassable terrain again, * Makes the given worm fall down until it rests on impassable terrain again,
* or until it leaves the world in which it is in. * or until it leaves the world in which it is in.
* - Students working alone on the project must not override this method. * - Students working alone on the project must not override this method.
*/ */
default void fall(Worm worm) throws ModelException, MustNotImplementException { default void fall(Worm worm) throws ModelException, MustNotImplementException {
throw new MustNotImplementException(); throw new MustNotImplementException();
} }
/** /**
* Return the time needed by the given worm to jump to the nearest position * Return the time needed by the given worm to jump to the nearest position
* adjacent to impassable terrain. * adjacent to impassable terrain.
* - deltaT determines the resolution to be used in successive steps of the jump. * - deltaT determines the resolution to be used in successive steps of the jump.
*/ */
double getJumpTime(Worm worm, double deltaT) throws ModelException; double getJumpTime(Worm worm, double deltaT) throws ModelException;
/** /**
* Returns the location on the jump trajectory of the given worm * Returns the location on the jump trajectory of the given worm
* after a time t. * after a time t.
* - The resulting location is an array with two elements, * - The resulting location is an array with two elements,
* with the first element being the x-coordinate and the * with the first element being the x-coordinate and the
* second element the y-coordinate. * second element the y-coordinate.
*/ */
double[] getJumpStep(Worm worm, double t) throws ModelException; double[] getJumpStep(Worm worm, double t) throws ModelException;
/** /**
* Make the given worm jump using the given time step. * Make the given worm jump using the given time step.
* - The given time step determines a time interval during which * - The given time step determines a time interval during which
* you may assume that the worm will not move through a piece * you may assume that the worm will not move through a piece
* of impassable terrain. * of impassable terrain.
*/ */
void jump(Worm worm, double timeStep) throws ModelException; void jump(Worm worm, double timeStep) throws ModelException;
/************ /************
* FOOD * FOOD
************/ ************/
/** /**
* Create and return a new portion of food that is positioned at the given * Create and return a new portion of food that is positioned at the given
* location in the given world. * location in the given world.
* = If the given world is not effective, the new food is simply positioned * = If the given world is not effective, the new food is simply positioned
* at the given location. * at the given location.
*/ */
Food createFood(World world, double[] location) throws ModelException; Food createFood(World world, double[] location) throws ModelException;
/** /**
* Terminate the given portion of food. * Terminate the given portion of food.
*/ */
void terminate(Food food) throws ModelException; void terminate(Food food) throws ModelException;
/** /**
* Check whether the given portion of food is terminated. * Check whether the given portion of food is terminated.
*/ */
boolean isTerminated(Food food) throws ModelException; boolean isTerminated(Food food) throws ModelException;
/** /**
* Return the current location of the given portion of food. * Return the current location of the given portion of food.
* - The resulting array contains the the x-coordinate of the given worm * - The resulting array contains the the x-coordinate of the given worm
* followed by its y-coordinate. * followed by its y-coordinate.
*/ */
double[] getLocation(Food food) throws ModelException; double[] getLocation(Food food) throws ModelException;
/** /**
* Return the radius of the given portion of food. * Return the radius of the given portion of food.
*/ */
double getRadius(Food food) throws ModelException; double getRadius(Food food) throws ModelException;
/** /**
* Return the mass of the given portion of food. * Return the mass of the given portion of food.
*/ */
double getMass(Food food) throws ModelException; double getMass(Food food) throws ModelException;
/** /**
* Return the world to which this portion of food belongs. * Return the world to which this portion of food belongs.
*/ */
World getWorld(Food food) throws ModelException; World getWorld(Food food) throws ModelException;
/**
/******** * Make the given worm eat a portion of food.
* TEAM */
********/ public void eat(Worm worm);
/** /********
* Create a new team for the given world with given name and with no members yet. * TEAM
* - Students working alone on the project must not override this method. ********/
*/
default Team createTeam(World world, String name) /**
throws ModelException, MustNotImplementException { * Create a new team for the given world with given name and with no members yet.
throw new MustNotImplementException(); * - Students working alone on the project must not override this method.
} */
default Team createTeam(World world, String name)
/** throws ModelException, MustNotImplementException {
* Terminate the given team. throw new MustNotImplementException();
*/ }
default void terminate(Team team) throws ModelException, MustNotImplementException {
throw new MustNotImplementException(); /**
} * Terminate the given team.
*/
/** default void terminate(Team team) throws ModelException, MustNotImplementException {
* Check whether the given portion of food is terminated. throw new MustNotImplementException();
*/ }
default boolean isTerminated(Team team) throws ModelException, MustNotImplementException {
throw new MustNotImplementException(); /**
} * Check whether the given portion of food is terminated.
*/
/** default boolean isTerminated(Team team) throws ModelException, MustNotImplementException {
* Return the name of the given team. throw new MustNotImplementException();
* - Students working alone on the project must not override this method. }
*/
default String getName(Team team) throws ModelException, MustNotImplementException { /**
throw new MustNotImplementException(); * Return the name of the given team.
} * - Students working alone on the project must not override this method.
*/
default String getName(Team team) throws ModelException, MustNotImplementException {
/** throw new MustNotImplementException();
* Return the team to which this worm belongs. }
* - Students working alone on the project must not override this method.
*/
default Team getTeam(Worm worm) throws ModelException { /**
throw new MustNotImplementException(); * Return the team to which this worm belongs.
} * - Students working alone on the project must not override this method.
*/
/** default Team getTeam(Worm worm) throws ModelException {
* Return the number of worms in the given team. throw new MustNotImplementException();
* - Students working alone on the project must not override this method. }
*/
default int getNbWormsOfTeam(Team team) /**
throws ModelException, MustNotImplementException { * Return the number of worms in the given team.
throw new MustNotImplementException(); * - Students working alone on the project must not override this method.
} */
default int getNbWormsOfTeam(Team team)
/** throws ModelException, MustNotImplementException {
* Return a list of all the worms in the given team, sorted alphabetically. throw new MustNotImplementException();
* This method must run in linear time. }
* - Students working alone on the project must not override this method.
*/ /**
default List<Worm> getAllWormsOfTeam(Team team) * Return a list of all the worms in the given team, sorted alphabetically.
throws ModelException, MustNotImplementException { * This method must run in linear time.
throw new MustNotImplementException(); * - Students working alone on the project must not override this method.
}; */
default List<Worm> getAllWormsOfTeam(Team team)
/** throws ModelException, MustNotImplementException {
* Add the given worms to the given team. throw new MustNotImplementException();
* - Students working alone on the project must not override this method. };
*/
default void addWormsToTeam(Team team, Worm... worms) /**
throws ModelException, MustNotImplementException { * Add the given worms to the given team.
throw new MustNotImplementException(); * - Students working alone on the project must not override this method.
} */
default void addWormsToTeam(Team team, Worm... worms)
/** throws ModelException, MustNotImplementException {
* Remove the given worms from the given team. throw new MustNotImplementException();
* - Students working alone on the project must not override this method. }
*/
default void removeWormsFromTeam(Team team, Worm... worms) /**
throws ModelException, MustNotImplementException { * Remove the given worms from the given team.
throw new MustNotImplementException(); * - Students working alone on the project must not override this method.
} */
default void removeWormsFromTeam(Team team, Worm... worms)
/** throws ModelException, MustNotImplementException {
* Merge the given teams. throw new MustNotImplementException();
* - All the worms of the supplying team are transferred to the receiving team. }
* - Students working alone on the project must not override this method.
*/ /**
default void mergeTeams(Team recevingTeam, Team supplyingTeam) * Merge the given teams.
throws ModelException, MustNotImplementException { * - All the worms of the supplying team are transferred to the receiving team.
throw new MustNotImplementException(); * - Students working alone on the project must not override this method.
} */
default void mergeTeams(Team recevingTeam, Team supplyingTeam)
throws ModelException, MustNotImplementException {
throw new MustNotImplementException();
}
} }

View File

@@ -9,6 +9,7 @@ import worms.internal.gui.game.commands.AddNewFood;
import worms.internal.gui.game.commands.AddNewTeam; import worms.internal.gui.game.commands.AddNewTeam;
import worms.internal.gui.game.commands.AddNewWorm; import worms.internal.gui.game.commands.AddNewWorm;
import worms.internal.gui.game.commands.Command; import worms.internal.gui.game.commands.Command;
import worms.internal.gui.game.commands.Eat;
import worms.internal.gui.game.commands.Jump; import worms.internal.gui.game.commands.Jump;
import worms.internal.gui.game.commands.Move; import worms.internal.gui.game.commands.Move;
import worms.internal.gui.game.commands.Rename; import worms.internal.gui.game.commands.Rename;
@@ -87,6 +88,10 @@ class DefaultActionHandler implements IActionHandler {
executeCommand(new Rename(getFacade(), worm, newName, getScreen())); executeCommand(new Rename(getFacade(), worm, newName, getScreen()));
} }
public void eat(Worm worm) {
executeCommand(new Eat(getFacade(), worm, getScreen()));
}
public void selectNextWorm() { public void selectNextWorm() {
executeCommand(new SelectNextWorm(getFacade(), getScreen())); executeCommand(new SelectNextWorm(getFacade(), getScreen()));
} }

View File

@@ -217,6 +217,14 @@ public class PlayGameScreen extends Screen {
} }
public void eat() {
Worm worm = getSelectedWorm();
if (worm != null) {
userActionHandler.eat(worm);
}
}
public void turn(double angle) { public void turn(double angle) {
Worm worm = getSelectedWorm(); Worm worm = getSelectedWorm();
angle = GUIUtils.restrictAngle(angle, -Math.PI); angle = GUIUtils.restrictAngle(angle, -Math.PI);

View File

@@ -207,7 +207,7 @@ public class PlayGameScreenPainter extends AbstractPainter<PlayGameScreen> {
double hitPoints = sprite.getHitPoints().doubleValue(); double hitPoints = sprite.getHitPoints().doubleValue();
double maxHitPoints = 2000; double maxHitPoints = 2000;
hitPoints = Math.max(hitPoints, maxHitPoints); hitPoints = Math.min(hitPoints, maxHitPoints);
RoundRectangle2D hitpointsBarFill = new RoundRectangle2D.Double(x RoundRectangle2D hitpointsBarFill = new RoundRectangle2D.Double(x
- ACTION_BAR_WIDTH / 2, y + spriteHeight / 2 - ACTION_BAR_WIDTH / 2, y + spriteHeight / 2

View File

@@ -0,0 +1,37 @@
package worms.internal.gui.game.commands;
import worms.facade.IFacade;
import worms.internal.gui.game.PlayGameScreen;
import worms.internal.gui.messages.MessageType;
import worms.model.Food;
import worms.model.Worm;
import worms.util.ModelException;
public class Eat extends InstantaneousCommand {
private final Worm worm;
public Eat(IFacade facade, Worm worm,
PlayGameScreen screen) {
super(facade, screen);
this.worm = worm;
}
@Override
protected boolean canStart() {
return worm != null;
}
@Override
protected void doStartExecution() {
try {
long nbFoodBefore = getFacade().getAllItems(getWorld()).stream().filter(Food.class::isInstance).count();
getFacade().eat(worm);
long nbFoodAfter = getFacade().getAllItems(getWorld()).stream().filter(Food.class::isInstance).count();
if (nbFoodAfter < nbFoodBefore) {
getScreen().addMessage("Yummie!", MessageType.INFO);
}
} catch (ModelException e) {
getScreen().addMessage("This worm cannot eat.", MessageType.ERROR);
}
}
}

View File

@@ -51,6 +51,10 @@ public class DefaultInputMode extends InputMode<PlayGameScreen> {
case 'N': case 'N':
getScreen().renameWorm(); getScreen().renameWorm();
break; break;
case 'e':
case 'E':
getScreen().eat();
break;
} }
} }