From 00c2ba041b65d8777925da699125f10911f4a7e0 Mon Sep 17 00:00:00 2001 From: Pacien TRAN-GIRARD Date: Sat, 21 Nov 2015 18:47:10 +0100 Subject: Handle the "stuck" case --- src/ch/epfl/maze/physical/ProbabilisticAnimal.java | 1 + 1 file changed, 1 insertion(+) (limited to 'src/ch/epfl/maze/physical') diff --git a/src/ch/epfl/maze/physical/ProbabilisticAnimal.java b/src/ch/epfl/maze/physical/ProbabilisticAnimal.java index 6b0c57f..f62fea1 100644 --- a/src/ch/epfl/maze/physical/ProbabilisticAnimal.java +++ b/src/ch/epfl/maze/physical/ProbabilisticAnimal.java @@ -32,6 +32,7 @@ abstract public class ProbabilisticAnimal extends Animal { @Override public Direction move(Direction[] choices) { + if (choices.length == 0) return Direction.NONE; return choices[randomSource.nextInt(choices.length)]; } -- cgit v1.2.3