From 7ca0a14ea2f80c3987934cdc2e16c9ae91bf73cd Mon Sep 17 00:00:00 2001 From: CyB3RC0nN0R Date: Wed, 1 Jul 2020 14:33:23 +0200 Subject: [PATCH] Simplify FoodFactory#generateFoodLocation --- src/main/dev/lh/FoodFactory.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/dev/lh/FoodFactory.java b/src/main/dev/lh/FoodFactory.java index ae8691a..f7c0b23 100755 --- a/src/main/dev/lh/FoodFactory.java +++ b/src/main/dev/lh/FoodFactory.java @@ -119,8 +119,7 @@ public class FoodFactory { public Point generateFoodLocation(int width, int height) { assert (width > 100 && height > 100); Random r = new Random(); - pFood = new Point(r.nextInt(width - 100) + 50, r.nextInt(height - 100) + 50); - return pFood; + return pFood = new Point(r.nextInt(width - 100) + 50, r.nextInt(height - 100) + 50); } /**