diff --git a/Robbie-Management-System/src/domain/R2D2.java b/Robbie-Management-System/src/domain/R2D2.java index 2d6c7a5..b869779 100644 --- a/Robbie-Management-System/src/domain/R2D2.java +++ b/Robbie-Management-System/src/domain/R2D2.java @@ -15,8 +15,22 @@ public class R2D2 extends Robotermodell implements Robot { @Override public int[] think(int[] zahlen) throws RobotException { - // TODO Auto-generated method stub - return null; + for (int i = 0; i < zahlen.length; i++) { + int kMin = i; + for (int k = i + 1; k < zahlen.length; k++) { + if (zahlen[k] < zahlen[kMin]) { + kMin = k; + } + } + + if(kMin != i) { + int zwischenspeicher = zahlen[i]; + zahlen[i] = zahlen[kMin]; + zahlen[kMin] = zwischenspeicher; + } + } + + return zahlen; } }